Hello!

Now that's a complicated script. How about

#!/bin/bash
pstree | grep radiusd || /etc/rc.d/init.d/radiusd restart

and putting that into cron (it is even small enough to be able to execute it 
every minute). Much simpler because it only checks if the server crashed by 
looking if the process is still there. Well, it skips the 8-second debug mode 
(why is that there anyway?) and doesn't log into /var/log/radtest.log. But 
you can see that the server was restarted anyway 
in /var/log/radius/radius.log.

Greetings,

Stefan Winter

> #!/bin/bash
> RESULT=`/usr/local/bin/radtest UserName PassWord localhost 1 testing123 |
> grep "Access-Accept" | wc -l`
> if [ $RESULT = "0" ]
> then
> d=`date`
> echo "$d" >> /var/log/radtest.log
> echo "" >> /var/log/radtest.log
> echo "Stopping Radius" >> /var/log/radtest.log
> /etc/rc.d/init.d/radiusd stop
> sleep 2
> echo "Starting Radius in Debug Mode" >> /var/log/radtest.log
> /usr/local/sbin/radiusd -X &
> sleep 8
> echo "Killing Debug Mode Radius" >> /var/log/radtest.log
> kill `ps axf | grep radiusd | grep -v grep | awk '{print $1}'`
> sleep 2
> echo "Starting Radius" >> /var/log/radtest.log
> /etc/rc.d/init.d/radiusd start
> echo "" >> /var/log/radtest.log
> echo "" >> /var/log/radtest.log
> fi

-- 
Stefan WINTER

Fondation RESTENA - Réseau Téléinformatique de l'Education Nationale et de 
la Recherche
Ingénieur réseau et système

6, rue Richard Coudenhove-Kalergi
L-1359 Luxembourg
email: [EMAIL PROTECTED]     tél.:      +352 424409-33
http://www.restena.lu                     fax:      +352 422473

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to