I can run my /etc/rc.local file manually, it runs on startup (echoing a string to a file), but the forever (npm package) is failing for some reason. I'm running the Amazon Linux AMI on an EC2 instance if that helps.
Where can I look to understand why it's failing or can you tell me what I'm doing wrong?
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
echo "rc.local is running..." > /tmp/rc.local-output
touch /var/lock/subsys/local
exec /usr/local/bin/forever start -c /usr/local/bin/node /var/www/node/myapp/app.js &
exec /usr/local/bin/forever start -c /usr/local/bin/node /var/www/node/myapp/tools/push/push_service.js &
Ok, things seems to be getting a bit better, I updated my rc.local file to this:
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
exec 2> /tmp/rc.local.log # send stderr from rc.local to a log file
exec 1>&2 # send stdout to the same log file
set -x # tell sh to display commands before execution
echo "rc.local is running..." >> /tmp/rc.local-output
touch /var/lock/subsys/local
/usr/local/bin/forever start /var/www/node/myapp/app.js &
/usr/local/bin/forever start /var/www/node/myapp/tools/push/push_service.js &
And /tmp/rc.local.log is telling me this:
/usr/bin/env: node: No such file or directory
I suppose you still have the execution bits set?
ls -l /etc/rc.local
-rwxr-xr-x 1 root root 306 Dec 26 2010 /etc/rc.local
Also, the script or tool /usr/local/bin/forever must also be executable ('x' bits set appropriately), but that you would have detected when you test manually.
The only reason why I could imagine that this would not work on startup is something that it requires is not ready by then and thus the startup of the forever tool fails. Is forever a script? If so maybe you could show us what's in there?