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