This is what I have currently in monitrc file:
check process rocketjob
matching "rocketjob"
start program = "bin/bash -c 'source $HOME/.rvm/bin/rvm cd /home/ghias/projects/my_project/ && RAILS_ENV=production bundle exec rocketjob --quiet >> log/rocketjob.log'"
and it gives me this error in monit log file:
'rocketjob' failed to start (exit status 1) -- bin/bash: bin/bash: /.rvm/bin/rvm: No such file or directory
whereis rvm command gives me rvm: /home/user/.rvm/bin/rvm
What am I doing wrong?
There are some things in your command:
/bin/bash
with leading /
$HOME/.rvm/bin/rvm
with arguments cd
and /home/ghias/projects/my_project/
. I think there should be a ;
or &&
right before cd
You might also want to consider an executable with those commands. It is way easier to implement, read, and debug:
Contents of /root/monit_do_rocketjob
:
#!/bin/bash
source $HOME/.rvm/bin/rvm
cd /home/ghias/projects/my_project/
export RAILS_ENV=production
bundle exec rocketjob --quiet >> log/rocketjob.log
exit $?
Don't forget to make this executable.
Monit config:
check process rocketjob
matching "rocketjob"
start program = "/root/monit_do_rocketjob"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.