Support for legacy init script actions for systemd services

Bill Nottingham notting at redhat.com
Tue Jun 26 20:11:19 UTC 2012


THE PROBLEM

We have assorted init scripts that have historically defined custom actions.
Given that this is an unbounded set, it is impossible to handle them
natively in systemd. However, they're usually part of administrators muscle
memory.

Better late than never (and thanks to Michal Schmidt), I've added support to
/sbin/service for running legacy actions if specified.

HOW TO IMPLEMENT IN YOUR PACKAGE

For each legacy option (such as "xyzzy") supported by your init script (such
as "frobozz"), package an executable script named:

  /usr/libexec/initscripts/legacy-actions/frobozz/xyzzy

If this file exists and is executable, then when an administrator runs:

  /sbin/service frobozz xyzzy

this file will be executed, to do whatever. This file can be a symlink
somewhere else, or even a compiled executable if you really desire.

BEST PRACTICES

1) A legacy action of this sort should print to stderr the preferred way to
accomplish the task, if one is supported.

2) Don't package a legacy action for new scripts or actions that were not
supported by the prior init script; this is intended for compatibility with
existing scripts and/or administrator brains.

3) Don't package
/usr/libexec/initscripts/legacy-actions/frobozz/{start,stop,restart...},
 or we will hurt you. (And /sbin/service will likely be changed to ignore
 these actions if this becomes a problem.)

WHEN THIS WILL LAND

It's in initscripts git now, will package shortly for F18/F17/F16.

Questions? Comments?

Bill


More information about the devel mailing list