Bug#604855: unblock: shibboleth-sp2/2.3.1+dfsg-3
2010/11/25 Russ Allbery <email@example.com>:
> Ah, hm, that's a good point. I hadn't thought about that, since the old
> Shibboleth modules depended on Apache. But the current packages only
> I'm not sure the best way to do this. Check for whether apache2.2-common
> is installed, since it contains the init script? (Checking for the
> existence of the init script may be a lurking bug later for upstart
> systems, file-rc, systemd, etc.) Alternately, we could just ignore
> failures on the invoke-rc.d command to restart Apache.
> Does anyone have any suggestions about the best approach?
The intended behavior is to restart Apache only if is running. It must
not be started if it is stopped or not even available. It does matter
if the module is enabled, but only if Apache is also running.
I see at least two possible implementations:
1) use the 'status_of_proc' LSB function (there are many init scripts
doing this for the status command);
2) check if there is any Apache process running:
# pidof apache2 > /dev/null && invoke-rc.d apache2 restart