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
|
#!/bin/sh
[ -d pidfiles ] || mkdir pidfiles
../daemon -N -n test70 --pidfiles="`pwd`"/pidfiles -- sleep 60
sleep 1
echo "After first daemon starts (expect test70.pid and test70.clientpid, note inodes)"
ls -laspi pidfiles/test70* 2>/dev/null
echo
oldpid="`cat pidfiles/test70.pid`"
echo "After test70.pid deleted (expect only test70.clientpid, same inode)"
rm pidfiles/test70.pid
ls -laspi pidfiles/test70* 2>/dev/null
echo
echo "After second daemon starts (expect test70.pid and test70.clientpid, both with new inodes)"
../daemon -N -n test70 --pidfiles="`pwd`"/pidfiles -- sleep 60
sleep 1
ls -laspi pidfiles/test70* 2>/dev/null
echo
newpid="`cat pidfiles/test70.pid`"
echo "After first daemon is terminated (expect no change, two files, same new inodes)"
kill `echo $oldpid`
sleep 1
ls -laspi pidfiles/test70* 2>/dev/null
echo
echo "After second daemon is terminated (expect no files)"
kill `echo $newpid`
sleep 1
ls -laspi pidfiles/test70* 2>/dev/null
echo
|