RPM install restarts Apache if using package-based server
Description
Environment
Redhat or CentOS
Activity
Scott Cantor August 10, 2009 at 1:57 PM
Restart logic should be correct now for Red Hat and SuSE.
Scott Cantor August 4, 2009 at 3:45 PM
Never mind, I don't know what I was seeing when I tried this initially.
I moved this script into %post:
%if "%{_vendor}" == "redhat"
This adds the proper /etc/rc*.d links for the script
/sbin/chkconfig --add shibd
# On upgrade, restart components if they're already running.
if [ "$1" -gt "1" ] ; then
/etc/init.d/shibd status 1>/dev/null && /etc/init.d/shibd restart 1>/dev/null
%{!?_without_builtinapache:/etc/init.d/httpd status 1>/dev/null && /etc/init.d/httpd restart 1>/dev/null}
fi
%endif
That should restart both halves on upgrades. I'll review the SuSE situation a bit later.
Scott Cantor August 4, 2009 at 3:29 PMEdited
Peter, I was looking at moving the restart logic, but from what I can tell it's not working anyway. What is the intended semantic?
/etc/init.d/shibd status 1>/dev/null && /etc/init.d/shibd start 1>/dev/null
That seems to be backwards, no? If it's running, that returns 0 before the && and bails.
I assume what I want is:
/etc/init.d/shibd status 1>/dev/null || /etc/init.d/shibd restart 1>/dev/null
Scott Cantor June 30, 2009 at 2:34 PM
There's kind of a generic signal right now I try and use to deterimine whether to assume the native Apache may be used, which is the --without builtinapache option/macro.
It shouldn't do any harm to assume that if there's a native Apache it's ok to restart it, since worst case it's not using Shibboleth and if it's running, a restart won't matter. If it's not running, nothing will happen anyway.
peter June 30, 2009 at 2:09 PMEdited
Also the conditional restart of shibd should be moved to the proper scriptlet section (probably %post).
As for httpd I'm not sure a HUP signal (apachectl -k restart) is enough for reloading modules, maybe a full restart is needed. Also, since we're also relying on init.d stuff already, personally I'd probably only care for trying `/etc/init.d/{httpd,apache,apache2}" [cond]restart` and leaving it up to the deployer if their httpd is controlled from elsewhere.
But we could certainly go the distance and try several methods (listening processes, first apachectl in $PATH, etc.).
As per our discussion on the mailing list, an Apache restart would be helpful if shibd is going to be automatically restarted after an upgrade. Checking to see if they're using a package-based Apache install or not would also be a good idea.