Russ Allbery <r...@debian.org> writes: > Ferenc Wagner <wf...@niif.hu> writes: > >> Russ Allbery <r...@debian.org> writes: >> >>> Ferenc Wagner <wf...@niif.hu> writes: >>> >>>> Maybe invoke-rc.d --quiet apache2 restart || [ $? -eq 100 ] ? >>> >>> Ah, that's a good idea. I didn't realize invoke-rc.d had a special >>> exit status for a missing script. >> >> But anyway, can the Shibboleth module be enabled when Apache isn't >> installed? The restart is already protected by this check: >> >> if [ -f /etc/apache2/mods-enabled/shib2.load ] ; then >> invoke-rc.d apache2 restart >> fi > > I think it can if Apache is then removed (but not purged)
Sure, but this isn't a problem, because if /etc/apache2/mods-enabled is present, then /etc/init.d/apache2 is also present[1], and quietly returns success if the actual daemon is not installed. [1] Well, at least they belong to the same package, but they are under /etc, so may be freely changed by the system administrator. I don't think we should care for such pathologic cases. Michael Biebl <bi...@debian.org> writes: > the apache init script already has a status method, why don't you use > > invoke-rc.d apache2 status >/dev/null 2>&1 && invoke-rc.d apache2 restart I like this idea. Any objections against the following code? if [ -f /etc/apache2/mods-enabled/shib2.load ] ; then if invoke-rc.d apache2 status >/dev/null ; then invoke-rc.d apache2 restart fi fi I decided to swap &&s for readability and "|| true" for keeping the exit status of the restart operation should we decide to actually try that. -- Thanks, Feri. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org