Created
November 22, 2013 12:36
-
-
Save andineck/7599208 to your computer and use it in GitHub Desktop.
startup script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
touch starter.sh | |
chmod 754 starter.sh | |
nano starter.sh | |
# file content: | |
#!/bin/sh | |
if [ $(ps aux | grep $USER | grep node | grep -v grep | wc -l | tr -s "\n") -eq 0 ] | |
then | |
export PATH=/usr/local/bin:$PATH | |
forever start --sourceDir /path/to/your/node/app main.js >> /path/to/log.txt 2>&1 | |
fi | |
# end file content | |
# add it to cron job | |
sudo nano crontab -e | |
> @reboot /path/to/starter.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment