1#!/bin/sh 2 3base=`basename $0` 4 5echo "1..2" 6 7name="pkill -LF <pidfile>" 8pidfile=$(pwd)/pidfile.txt 9sleep=$(pwd)/sleep.txt 10ln -sf /bin/sleep $sleep 11daemon -p $pidfile $sleep 5 12sleep 0.3 13pkill -f -L -F $pidfile $sleep 14ec=$? 15case $ec in 160) 17 echo "ok 1 - $name" 18 ;; 19*) 20 echo "not ok 1 - $name" 21 ;; 22esac 23 24# Be sure we cannot kill process which pidfile is not locked. 25$sleep 5 & 26sleep 0.3 27chpid=$! 28echo $chpid > $pidfile 29pkill -f -L -F $pidfile $sleep 2>/dev/null 30ec=$? 31case $ec in 320) 33 echo "not ok 2 - $name" 34 ;; 35*) 36 echo "ok 2 - $name" 37 ;; 38esac 39 40kill "$chpid" 41rm -f $pidfile 42rm -f $sleep 43