File: radwatch.in

package info (click to toggle)
freeradius 1.0.2-4sarge3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 9,792 kB
  • ctags: 6,980
  • sloc: ansic: 52,618; sh: 9,731; php: 5,764; perl: 2,309; makefile: 1,056; sql: 730; python: 159; tcl: 33; sed: 23
file content (60 lines) | stat: -rwxr-xr-x 1,311 bytes parent folder | download | duplicates (3)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#! /bin/sh
#
# radwatch	Script to watch RADIUS. Sends mail to root and
#		restarts radiusd when it dies [which ofcourse
#		never happens :)]
#
#   WARNING!  This script SHOULD NOT BE USED!  It's only here for historical
#             purposes, and WILL be deleted in a future version of the
#             the server.
#
#             If you want to watch and re-start the server, we recommend
#             reading the file doc/supervise-radiusd.txt
#
#
# Version:	$Id: radwatch.in,v 1.7 2002/11/08 16:08:52 pnixon Exp $
#

prefix=@prefix@
exec_prefix=@exec_prefix@
sbindir=@sbindir@
localstatedir=@localstatedir@
logdir=@logdir@
rundir=${localstatedir}/run/radiusd

MAILTO=root
RADIUSD=$sbindir/radiusd

exec >> $logdir/radwatch.log 2>&1

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

cd $logdir
[ -d $logdir/radacct ] && cd $logdir/radacct
ulimit -c unlimited

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

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

echo "$!" > $rundir/radwatch.pid

sleep 1