NeoRouter
http://www.neorouter.com/forum/

Have to reinstall client on Ubuntu64 every time
http://www.neorouter.com/forum/viewtopic.php?f=8&t=4339
Page 1 of 1

Author:  Lobotron [ Mon Aug 30, 2010 11:42 am ]
Post subject:  Have to reinstall client on Ubuntu64 every time

If my Ubuntu64 machine loses its connection to the server ( server is Windows), my machine no longer connects automatically to the server and I cannot re-connect using nrclient. I have to (every single time) reinstall the client on the Ubuntu machine, then use nrclient to connect back to the server. There must be a way to fix this.

Author:  kevinz [ Mon Aug 30, 2010 12:40 pm ]
Post subject:  Re: Have to reinstall client on Ubuntu64 every time

Hi Lobotron,

NeoRouter client service (nrservice) should have reconnected to the NeoRouter server automatically if it's not crashed or gets killed for some reasons. So please check if the service is running (ps aux|grep nrservice). If you can collect log file of the nrservice, we'd like to help you figure out the issue.

One the other hand, I'd like to post scripts here, which can be used for monitoring the specified process and restart it. Hope it helps.

1. To monitor and automatically restart NeoRouter service on Linux:
Code:
It will check the nrservice process once a minute, if it's down, it will restart it.

a.sudo vi /usr/local/ZebraNetworkSystems/NeoRouter/CheckService.sh
b.put the following lines in the script

#!/bin/sh
SERVICE='nrservice'
LOGFILE='/dev/null'
if [ "$( ps ax | grep -v grep | grep $SERVICE)" != "" ]; then
  echo "$SERVICE is running" >> $LOGFILE
  date >> $LOGFILE
else
  echo "$SERVICE is down" >> $LOGFILE
  date >> $LOGFILE
  /sbin/start-stop-daemon --start --background -m --pidfile /var/run/nrservice.pid --exec /usr/bin/nrservice >> $LOGFILE
fi

c.save it and make it executable
sudo chmod 755 /usr/local/ZebraNetworkSystems/NeoRouter/CheckService.sh

d.sudo crontab -e
e.add line
*/1 * * * * /usr/local/ZebraNetworkSystems/NeoRouter/CheckService.sh

f.restart cron
sudo service cron stop
sudo service cron start



2. To monitor and automatically restart NRServer if it's down on linux
Code:
It will check the nrserver process once a minute, if it's down, it will restart it.

a.sudo vi /usr/local/ZebraNetworkSystems/NeoRouter/CheckServer.sh
b.put the following lines in the script

#!/bin/sh
SERVICE='nrserver'
LOGFILE='/dev/null'
if [ "$( ps ax | grep -v grep | grep $SERVICE)" != "" ]; then
  echo "$SERVICE is running" >> $LOGFILE
  date >> /tmp/nrserver.log
else
  echo "$SERVICE is down" >> $LOGFILE
  date >> /tmp/nrserver.log
  /sbin/start-stop-daemon --start --background -m --pidfile /var/run/nrserver.pid --exec /usr/bin/nrserver >> $LOGFILE
fi

c.save it and make it executable
sudo chmod 755 /usr/local/ZebraNetworkSystems/NeoRouter/CheckServer.sh

d.sudo crontab -e
e.add line
*/1 * * * * /usr/local/ZebraNetworkSystems/NeoRouter/CheckServer.sh

f.restart cron
sudo service cron stop
sudo service cron start

Author:  johnny2000 [ Fri Sep 16, 2016 12:30 pm ]
Post subject:  Re: Have to reinstall client on Ubuntu64 every time

Will this script works with CentOS?

Author:  kevinz [ Fri Sep 16, 2016 4:34 pm ]
Post subject:  Re: Have to reinstall client on Ubuntu64 every time

Hi johnny2000,

No, it cannot run on CentOS/RH, as some commands may be different, but the main logic should be same. You may need to replace some commands with the equivalent on CentOS.

Thanks,
KevinZ - NeoRouter team

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/