How can I run a ruby script (rbenv) in bash script for crontab?
I tried:
#!/bin/bash
process=ruby
if ps ax | grep -v grep | grep $process > /dev/null
then
exit
else
ruby /home/jason/ruby/project.rb &
fi
exit
enter code here
It works if I run the script as:
./{nameofscript}.sh
but it does not work when I put it on crontab. My crontab setting is like this:
*/2 * * * * root sh /home/jason/ruby/run.sh