On a fresh install of OpenSuse 12.3, I want to "daemonize" a program. And, on all examples found on Internet, I see I have to create first a /etc/init.d/myscript
based on the /etc/init.d/skeleton
…
But I have no /etc/init.d/skeleton
… Is there another place for this file? Or maybe I need to install something?
The system is up-to-date, I checked that first.
I know I can try to copy another existing /etc/init.d
script and modify it, or create a new one, but I would know if I am doing wrong, or if there is another special way to do that on OpenSuse.
Best Answer
I'm not sure where the
/etc/init.d/skeleton
file disappeared but I would expect that this change is related to replacement of traditionalSysV init daemon
withsystemd
since OpenSUSE 12.systemd
is fully compatible with well knows initscripts but I would prefer to use thesystemd
model of starting services.In my opinion, traditional initscripts can be tricky and sometimes, they may require deeper knowledge of shell scripting. On the other hand,
systemd
"initscript" orunit
configuration file for a service (man systemd.unit
) is easier to maintain as it has simple syntax similar to.INI
files. You may try to write some unit file and enable it by dropping the file to the/etc/systemd/system
directory. This directory has higher precedence than the default directory/usr/lib/systemd/system
. An example ofsshd
daemon unit follows:Or you may stick with "legacy" initscripts as you are used. But you will loose some neat features of
systemd
like:Finally, keep in mind that if there is a unit (
sshd.service
) with the same basename as an initscript (/etc/init.d/sshd
), then, the initscript is ignored and thesystemd
unit will be preffered and used.