]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Check if radius is running
authorSebastian Hagedorn <Hagedorn@uni-koeln.de>
Fri, 29 May 2015 12:52:37 +0000 (14:52 +0200)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 1 Jun 2015 08:02:33 +0000 (02:02 -0600)
post-receive checks if radius is running. If not, it will accept
changes based on the config check, without trying to restart radiusd.

scripts/git/post-receive

index ed5734a49f12458aa3a6bcaea9d9a0a249efc4f5..3f44994f56a7d98c8574b24bb899c251cba86e0e 100755 (executable)
@@ -9,12 +9,16 @@
 #
 # Copyright 2012  Arran Cudbard-Bell <a.cudbard-bell@freeradius.org>
 
+PATH=/bin:/usr/bin:/usr/sbin:/sbin
 # Tag to update when we successfully manage to start the server with a new configuration
 : ${STABLE_TAG='stable'}
 
 # Descriptive name of daemon
 : ${DAEMON_DESC='FreeRADIUS'}
 
+# Init script for radiusd
+: ${DAEMON_STATUS='/etc/init.d/radiusd status'}
+
 # Command used to restart the RADIUS daemon
 : ${DAEMON_REST='radmin -e hup'}
 
@@ -65,6 +69,13 @@ conf_check () {
        return $ret
 }
 
+daemon_status () {
+       echo -n "Checking if radiusd is running ... "
+       $DAEMON_STATUS; ret=$?
+
+       return $ret
+}
+
 daemon_restart () {
        echo -n "Restarting server... "
 
@@ -113,7 +124,7 @@ if ! conf_check; then
        conf_rollback
        exit 64
 else
-       if ! daemon_restart; then
+       if daemon_status && ! daemon_restart ; then
                if ! conf_rollback; then
                        echo "WARNING: Manually verify $DAEMON_DESC status immediately!"
                        exit 64