Restart Sidekiq

To restart Sidekiq, you’ll first need to stop the running Sidekiq process and then start it again. Here’s how to do it:

Option 1: Using kill command

  1. Find the process ID (PID) of the running Sidekiq process by using the ps command:
1
ps aux | grep sidekiq

Look for the line containing “sidekiq” and note the PID, which is the second column in the output.

  1. Stop the Sidekiq process using the kill command:
1
kill <PID>

Replace <PID> with the process ID you noted in step 1.

  1. Start Sidekiq again by running the sidekiq command in your Rails application directory:
1
bundle exec sidekiq

Option 2: Using an initializer script or systemd service (recommended for production)

If you have set up Sidekiq as a systemd service or using an initializer script in a production environment, follow these steps:

  1. Restart Sidekiq using the systemctl command (for systemd service):
1
sudo systemctl restart sidekiq

OR

Restart Sidekiq using the service command (for an initializer script):

1
sudo service sidekiq restart
  1. Check the status of the Sidekiq service to ensure it’s running:

For systemd:

1
sudo systemctl status sidekiq

For an initializer script:

1
sudo service sidekiq status

In both cases, make sure you have the appropriate configuration files in place for Sidekiq to run as a service. For more information on setting up Sidekiq as a systemd service, refer to the official Sidekiq documentation.