Incorrect and missing functionallity of the Matterhorn SysV-Init script

Steps to reproduce

There are a couple of errors, misbehaviours and missing things in the current init script:

a) „service matterhorn restart" should stop matterhorn (like matterhorn stop whould) and then in any case start matterhorn. So if matterhorn was not running before it should run afterwards. That does not work. It will youst tell you that Matterhorn is not running.
b) condrestart (and try-restart) should behave like "matterhorn restart" does at the moment: Restart matterhorn if it was running before. No start if matterhorn was not running before. These targets do not exist at the moment.
c) reload: reload the configuration of the service without actually stopping and restarting the service (if the service does not support this, do nothing). The Matterhorn init script misses this target.
d) force-reload: reload the configuration of the service and restart it so that it takes effect. The Matterhorn init script misses this target.
e) "[...] They must not kill unrelated (but perhaps, similarly-named) user processes as a result of their normal actions. [...]": The current init script is will just kill the first process wich contains "felix.jar" regardless of what it is or if it is important. So it might not even stop Matterhorn, even though it told you that it did that.
f) Try the following: startup "vim felix.jar.txt" and ask if matterhorn is running "service matterhorn status". It will tell you that Matterhorn is runnung and give you the pid of vim (same reason as e).
g)"Every SysV-style initscript that starts a resident daemon – as opposed to those that start tasks (e.g. firstboot and kdump) – must manage a /var/lock/subsys/<service_name> file. This is important because on shutdown, SysV init fails to stop services that do not create /var/lock/subsys/<service_name> files. Some upstreams do not code these specifics into their scripts and thus their services are forced to crash on shutdown." Matterhorn does not create a lock file. A "touch /var/lock/subsys/matterhorn" would be enough. (And a rm in stop).
h) In most cases the init script will give you a wrong exit code.
It should be (From Fedora docs):

== Exit Codes for the Status Action ==
0: program is running or service is OK
1: program is dead and /var/run pid file exists
2: program is dead and /var/lock lock file exists
3: program is not running
4: program or service status is unknown
5-99: reserved for future LSB use
100-149: reserved for distribution use
150-199: reserved for application use
200-254: reserved

== Exit Codes for non-Status Actions ==
For all other initscript actions, the init script must return an exit status of zero if the action was successful. In addition to straightforward success, the following situations are also to be considered successful:

  • restarting a service (instead of reloading it) with the force-reload argument

  • running start on a service already running

  • running stop on a service already stopped or not running

  • running restart on a service already stopped or not running

  • running condrestart or try-restart on a service already stopped or not running

In case of an error while processing any non-Status initscript action, the initscript must print an error message and exit with the appropriate non-zero status code:
1: generic or unspecified error (current practice)
2: invalid or excess argument(s)
3: unimplemented feature (for example, "reload")
4: user had insufficient privilege
5: program is not installed
6: program is not configured
7: program is not running
8-99: reserved for future LSB use
100-149: reserved for distribution use
150-199: reserved for application use
200-254: reserved

As you see, there are a lot of issues in the init script and some of them might effect other parts of the system which do not belong to Matterhorn. This is not good...

Activity

Show:
Lars Kiesow
April 12, 2013, 8:13 PM
Edited

New version based on the review.
Files are attached (matterhorn-scripts.v2.tar.gz) and online at:
https://github.com/lkiesow/matterhorn-scripts

Lars Kiesow
May 25, 2013, 11:55 AM

The scripts have been reviewed for a while (CR-MH-516) and all found issues have been fixed (Thanks especially to Rubén Pérez Vázquez for spending a lot of time on this). We have also tested them here at Osnabrück in a couple of real systems and I would say that they are ready to use.

The latest files are attached to this tickets.

Alternatively you can get them with:
$ git clone https://github.com/lkiesow/matterhorn-scripts
which will get you the filesystem structure as well.

To sum up the changes:

  • The SysV-initscript will ensure that only one instance of matterhorn is running and keep track of that.

  • The matterhorn script in /usr/sbin will let you start matterhorn as non-system process. We found it especially helpful to use “matterhorn --interactive” to find errors in your configuration files.

  • The service.conf can be used to change the behaviour of the startscript (The Matterhorn user, configuration folders, …)

Greg Logan
June 4, 2013, 8:44 PM

Lars, I'm bumping this to 1.5 because it requires some semi-major refactoring of the install scripts on the CA side of things. Since we're going to be messing around with these things for 1.5 (git) anyway, let's do it then.

Lars Kiesow
August 17, 2013, 2:27 PM

I updated the scripts to include fixes for and other things.

To make things easier for me, for now I will keep keep them in the following git repository:
https://github.com/lkiesow/matterhorn-scripts

Tobias Schiebeck
January 31, 2014, 4:18 PM

Merged into develop with 910e9f1.

Assignee

Lars Kiesow

Reporter

Lars Kiesow

Severity

Incorrectly Functioning Without Workaround

Tags (folksonomy)

None

Fix versions

Affects versions

Priority

Critical
Configure