summaryrefslogtreecommitdiff
blob: 26fcefcbf0f1d73a1e842a173e66e13fb063a5a8 (plain)
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
#!/bin/sh
#remove stale pid files
if [ -e /var/run/xinetd.pid ]
then
	mypids="`cat /var/run/xinetd.pid`"
	myrun=`/sbin/pidof xinetd`
	ok=0
	for x in $mypids
	do
		if [ "$myrun" = "$x" ]
		then
			#this is a running xinetd process, pidfile ok
			ok=1
		fi
	done
	if [ "$ok" = "0" ]
	then
		#bogus pidfile, remove
		rm /var/run/xinetd.pid
	fi
fi
if [ ! -e /var/run/xinetd.pid ]
then
	/usr/sbin/xinetd -pidfile /var/run/xinetd.pid
	/usr/bin/sleep 1
fi
exec /usr/bin/watchpid `cat /var/run/xinetd.pid`