Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- set -x
- count=0
- while :
- do
- if test $count -lt 40
- then
- mail -s "server.js started just now" myemail@gmail.com < /dev/null
- fi
- count=`expr $count + 1`
- date1=`date +%s` #get unix time
- cd /home/login/railways/nodejs
- echo "Starting time is $date1"
- /usr/bin/nodejs server.js >> server.log
- date2=`date +%s` #get unix time
- if test $date1 -eq $date2
- then
- msg="exiting as process has failed"
- echo $msg
- if test $count -lt 40
- then
- mail -s $msg myemail@gmail.com < /dev/null
- fi
- sleep 10
- fi
- echo "restarting the process"
- sleep 1
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement