File: radwatch

package info (click to toggle)
xtradius 1.2.1-beta2-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,256 kB
  • ctags: 921
  • sloc: ansic: 10,183; perl: 733; sh: 267; makefile: 148; sql: 21
file content (44 lines) | stat: -rw-r--r-- 834 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#! /bin/sh
#
# radwatch	Script to watch RADIUS. Sends mail to root and
#		restarts radiusd when it dies [which ofcourse
#		never happens :)]
#
# Version:	@(#)radwatch  1.10  28-Nov-1998  miquels@cistron.nl
#

MAILTO=root
RADIUSD=/usr/local/sbin/radiusd

exec >> /var/log/radwatch.log 2>&1

# get the path to the radiusd
if [ "$1" ] && [ -x "$1" ]
then
	RADIUSD=$1
	shift
fi

cd /var/log
[ -d /var/log/radacct ] && cd /var/log/radacct
ulimit -c unlimited

(
	trap 'echo `date`: exit; kill `cat /var/run/radiusd.pid`; exit 0' TERM
	trap "" HUP TSTP

	while :
	do
		# Use `wait', otherwise the trap doesn't work.
		$RADIUSD -f $* &
		wait
		exec >> /var/log/radwatch.log 2>&1
		echo "`date`: Radius died, restarting.."
		date | mail -s "Radius died, restarting.." $MAILTO
		sleep 10
	done
) &

echo "$!" > /var/run/radwatch.pid

sleep 1