Friday, 21 April 2017

How do I add user forever path to execute node apps on cron @reboot, when npm installed as non-root

Im trying to run node apps on reboot, so i put in a line @reboot /home/user/bin/start-sites.sh in crontab. The startup script contains a forever command. However its not working.

I highly suspect the problem is because there is no npm in /usr/local/bin, this is by design. I find no need to ever install node/npm modules as root or sudo, its actually absurd to me, since it frequently causes major ECONN and perm issues, and a cluster*&^% of confusion, when not necessary. (im not interested in sudo evangalizing, im a firm believer that only user install is necessary)

So based on this, do you think crond is just not having access to forever? Afterall, $ sudo forever or # forever doesnt exist, only $ forever does.

So when i run this script, how can i run as user, not as root, or how can i add the path so that cron knows what to do with the user script?



via blamb

No comments:

Post a Comment