I know this has been as been asked before. I followed lots of tuts how to do this and I want to do it with cron.
First problem is sudo vs regular user. I write in nodeJS, while I managed to have both users on the same up-to-date node version I’d prefer not to use sudo.
This is what I tried:
crontab -eand use nano
- I add
@reboot /home/pi/.nvm/versions/node/v7.5.0/bin/node /home/pi/projects/pi-bootup/server.js, exit and save.
- I insert
/home/pi/.nvm/versions/node/v7.5.0/bin/node /home/pi/projects/pi-bootup/server.jsto test if the command works (it does).
- I check with
ps -e|grep nodefor running node tasks (yup, they’re there)
- after reboot, I check for running node tasks with
ps -e|grep node. None started.
What am I doing wrong?
I also added
@reboot echo "hi" > /home/pi/reboot.txt 2>&1 and the file is created after reboot. So the reboot jobs run, just the node task isn’t running… or am I verifying this the wrong way?
Thanks in advance for any help. I’m new to Raspberry and Linux, (kinda new to node too).