I've installed node 0.10.2 and forever on my raspberry pi. I had to update npm in order to install forever. I've created the following bash script to run my node app, but when I run it, it just prints the forever help without ever actually starting forever. Even when I simply try to execute just the one line
sudo /opt/node/bin/forever start -p /root/.forever --sourceDir=/home/pi/nodecode/server.js
it still does not seem to work. My only thoughts are that perhaps it's an incompatible version of forever
export PATH=$PATH:/opt/node/bin
export NODE_PATH=$NODE_PATH:/opt/node/lib/node_modules
export HOME=/root
USER=pi
OUT=/home/pi/nodejs.log
case "$1" in
start)
echo "starting node"
sudo -u $USER /opt/node/bin/forever start -p /root/.forever --sourceDir=/home/pi/nodecode/server.js
;;
stop)
exec /opt/node/bin/forever stopall
;;
*)
echo "Usage: /etc/init.d/nodeup {start|stop}"
exit 1
;;
esac
exit 0
forever-service
. It's convenient, trust me.