1

I have created a service for systemctl which works perfectly but whenever I reboot the server it can't auto-restart itself.

The code for the service is:

[Unit]
Description=Service Description
[Service]
User=ubuntu
Group=ubuntu
WorkingDirectory=project_path
Restart=always
ExecStart=/home/ubuntu/.rvm/gems/ruby-2.6.3/wrappers/bundle exec /usr/share/rvm/rubies/ruby-2.6.3/bin/rake QUEUE=* resque:work

Path for the service is

/lib/systemd/system/worker.service

kenlukas
  • 3,101
  • 2
  • 16
  • 26

1 Answers1

2

The service you created needs to be enabled, not only by starting it, but by letting systemd know, that it exists. That can be done by using the command systemctl enable worker.service.

You might need to add some values to the config for getting the service to run properly, but without enabling the service it can't be triggered after a restart automatically.

creyD
  • 160
  • 5