Skip to content

Instantly share code, notes, and snippets.

View mmonette's full-sized avatar

Mike Monette mmonette

  • Reston, VA
  • 08:36 (UTC -04:00)
View GitHub Profile
@mmonette
mmonette / sysv.init.script.to.systemd.unit.file.md
Created September 25, 2018 19:27 — forked from houtianze/sysv.init.script.to.systemd.unit.file.md
Convert SysV Init scripts to Systemd Unit File

Let's say you have a SysV Init Script named foo

  1. Copy the file to /etc/init.d/foo

  2. Enable the SysV service: chkconfig --add foo

  3. Enable the SysV service: chkconfig foo on

  4. Start the service: service foo start. After this, systemd-sysv-generator will generate this file /run/systemd/generator.late/foo.service, copy this file to /etc/systemd/system by running: cp /run/systemd/generator.late/foo.service /etc/systemd/system/foo.service

  5. Edit /etc/systemd/system/foo.service by running systemctl edit foo.service, add in the following line to foo.servie (this makes the service installable)

[Install]