summaryrefslogtreecommitdiff
blob: 912f10fc3aeac4692e36c39aba67ec2deb6901b4 (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
#!/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
else
	/usr/sbin/xinetd -pidfile /var/run/xinetd.pid
	/usr/bin/sleep 1
fi
exec /usr/bin/watchpid `cat /var/run/xinetd.pid`