
$rvm_path/scripts/rvm cd /home/ubuntu/rails_project/ bundle exec sidekiqctl stop /home/ubuntu/rails_project/tmp/pids/sidekiq.pid 10'" as uid ubuntu as gid ubuntu Stop program = "/bin/bash -c 'export rvm_path=/home/ubuntu/.rvm. $rvm_path/scripts/rvm cd /home/ubuntu/rails_project bundle exec sidekiq -e production -L /home/ubuntu/rails_project/log/sidekiq.log -C /home/ubuntu/rails_project/config/sidekiq.yml -P /home/ubuntu/rails_project/tmp/pids/sidekiq.pid'" as uid ubuntu as gid ubuntu Start program = "/bin/bash -c 'export rvm_path=/home/ubuntu/.rvm. You may have to export your rvm_path variable and run the commands above as the user. error : 'sidekiq' process is not running If the process does not restart, and you see errors like these in log file – You can view the monit logfile at /var/log/monit.log Now, when you kill the sidekiq process on your server, it should restart automatically. To restart the monit daemon with updated configuration, run Next, you should check the syntax of your monit file using If multiple processes are being created, you should check whether the path to sidekiq pidfile is correct and the file is being updated properly. You can test out the start and stop commands in your terminal to see that they start and stop the correct sidekiq process, without creating multiple processes. Stop program = "/bin/bash -c ' cd /home/ubuntu/rails_project/ bundle exec sidekiqctl stop /home/ubuntu/rails_project/tmp/pids/sidekiq.pid 10'" Start program = "/bin/bash -c ' cd /home/ubuntu/rails_project bundle exec sidekiq -e production -L /home/ubuntu/rails_project/log/sidekiq.log -C /home/ubuntu/rails_project/config/sidekiq.yml -P /home/ubuntu/rails_project/tmp/pids/sidekiq.pid'" With pidfile /home/ubuntu/rails_project/tmp/pids/sidekiq.pid
#MONIT LOG FILE MONITORING CODE#
The timeout option lets you define the amount of time Monit will wait for the start/stop action to finish before giving up and reporting an error. The default is 30 seconds.Īssuming your home folder is /home/ubuntu and the path to your rails project is /home/ubuntu/rails_project, our code now looks like:
#MONIT LOG FILE MONITORING SERIES#
The start_command and stop_command are series of commands to navigate to project folder and run sidekiq from bundler. The path_to_sidekiq_pid is usually found in rails_project/tmp/pids/sidekiq.pid Stop program = stop_command with timeout y Start program = start_command with timeout x You can set up Gmail to send notifications (A comprehensive list of examples can be found here) We’ll be editing this file to configure monit for Sidekiq monitoring. Monit’s behaviour is defined in a control file called monitrc which can be usually found in Monit can be installed with a simple command: It can send mail alerts or automatically restart processes as per configuration. Monit is a handy utility that can be used to monitor memory, processes or services on your Unix machine or server.
