Where is my /etc/init.d/skeleton on OpenSuse 12.3?

6,004

I'm not sure where the /etc/init.d/skeleton file disappeared but I would expect that this change is related to replacement of traditional SysV init daemon with systemd since OpenSUSE 12. systemd is fully compatible with well knows initscripts but I would prefer to use the systemd 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" or unit 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 of sshd daemon unit follows:

[Unit]
Description=OpenSSH Daemon
After=syslog.target network.target

[Service]
EnvironmentFile=/etc/sysconfig/ssh
ExecStartPre=/usr/sbin/sshd-gen-keys-start
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=always

[Install]
WantedBy=multi-user.target

Or you may stick with "legacy" initscripts as you are used. But you will loose some neat features of systemd like:

  • faster boot time, real parallel startup of services
  • automatic dependency handling
  • moitoring of services and their automatic restart of crashed ones
  • and much more

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 the systemd unit will be preffered and used.

Share:
6,004

Related videos on Youtube

dsmsk80
Author by

dsmsk80

Updated on September 18, 2022

Comments

  • dsmsk80
    dsmsk80 over 1 year

    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.

    • Admin
      Admin over 10 years
      As dsmsk80 points out, the examples you found are for SysV init, which is on it's way to depreciation (but since it has been around longer than the internet, it has gotten lots of write-up over the years). OpenSUSE uses a new-fangled replacement, systemd.