systemd compatibility with SysV init scripts is provided by the systemd-sysv-generator, which writes systemd units on the fly calling the init script with proper arguments to implement start/stop/reload.
To do its job, systemd-sysv-generator depends heavily on the LSB headers of the SysV init script, which look like this:
### BEGIN INIT INFO
# Provides: lsb-ourdb
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop OurDB
# Description: OurDB is a very fast and reliable database
# engine used for illustrating init scripts
### END INIT INFO
If your SysV init script doesn't have proper LSB headers, it's likely that systemd-sysv-generator won't be able to do a good job of converting it automatically to a systemd unit...
The units generated by systemd-sysv-generator will be stored under /run/systemd/system
, so you can either look for the *.service
file there, or just use the systemctl cat
command to list the contents of the unit. You can potentially also add overrides to units generated from SysV init scripts, by using the systemctl edit
command. (That is useful, for example, if you want to add additional dependencies or ordering directives to the unit.)
But perhaps taking the plunge and converting the SysV init scripts to native systemd units is a better approach and will pay off long term, especially if the command is able to run in foreground (and not daemonize) and the SysV init scripts are daemonizing the commands themselves (in which case, systemd can do a better job at it, and will work better if it daemonizes the commands itself.)
Check out this article in Fedora Magazine for tips and tricks on how to convert SysV init scripts into systemd units, hopefully this will help get you started. Don't hesitate ask back here for more specifics if you get stumped while trying to convert the init scripts. Good luck!
apache2.service
. You can use that as a reference.