auto restarting in crontab
Greetings,
My script for monitoring Node.js app as follows. I put it in crontab for
auto-check and restart if failure.
#!/bin/bash
# scan the port
nc -z 127.0.0.1 3000
if [ $? -eq 0 ];then
exit
else
killall node
sleep 1
nohup serve -s /home/myUsername/workspace/xxx-frontend/build &
fi
I can run the script by manual, but in crontab it won't work. that
means, when node.js dies, it will not get restarted by this script
automatically.
Can you give any hints?
Thanks
Corey Hickman
Reply to: