Skip to content

Instantly share code, notes, and snippets.

@daneb
Last active April 30, 2019 05:13
Show Gist options
  • Save daneb/5ab468a142b1ba3b1e88da36237300d5 to your computer and use it in GitHub Desktop.
Save daneb/5ab468a142b1ba3b1e88da36237300d5 to your computer and use it in GitHub Desktop.
Using SysV init files with SystemD - Ubuntu
  1. Let's say you have a SysV Init Script named myservice
  2. Copy the file to /etc/init.d/myservice
  3. Enable the SysV service: update-rc.d myservice defaults
  4. Start the service: service myservice start.
  5. After this, systemd-sysv-generator will generate this file /run/systemd/generator.late/myservice.service.
    Copy this file to /etc/systemd/system by running: cp /run/systemd/generator.late/myservice.service /etc/systemd/system/myservice.service
  6. Edit /etc/systemd/system/myservice.service by running systemctl edit myservice.service. Add in the following line to myservice.service (this makes the service installable)
[Install]
WantedBy=multi-user.target
  1. Enable the service: systemctl enable foo.service
  2. Start the service: service myservice start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment