I am attempting to execute this code in a cron job:
a=`/home/mailmark/node/bin/forever list`; if [ "$a" == "No forever processes running" ]; then forever start /api.js; fi
The file in question, 'forever' contains this shebang:
#!usr/bin/env node
It returns this response:
/usr/bin/env: node: No such file or directory
But I have this code on the last line of the .bashrc file:
export PATH=/home/mailmark/node/bin:$PATH
What should I do to make my cron work?
Use the full path to node:
#!/usr/bin/env /home/mailmark/node/bin/node
cron
doesn't run in a "login shell", so .bash_profile
and .bashrc
are not loaded.
add . $HOME/.bashrc
to the beginning of your cron job.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With