Skip to content

Instantly share code, notes, and snippets.

@dstroot
Created May 23, 2012 20:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dstroot/2777778 to your computer and use it in GitHub Desktop.
Save dstroot/2777778 to your computer and use it in GitHub Desktop.
script to start forever after reboot
#!/bin/sh
if [ $(ps aux | grep $USER | grep node | grep -v grep | wc -l | tr -s "\n") -eq 0 ]
then
export NODE_ENV=production
export PATH=/usr/local/bin:$PATH
forever start ~/vizilinkz/server.js > /dev/null
# redirects port 80 to port 8080
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment