]> git.pld-linux.org Git - projects/rc-scripts.git/blame - t/status-pidfile.sh
rc.sysinit: move /proc/cmdline parsing to single function
[projects/rc-scripts.git] / t / status-pidfile.sh
CommitLineData
22cbb03f
ER
1#!/bin/sh
2
3# broken check with --pidfile specified:
4#
5# $ (. /etc/rc.d/init.d/functions; status --pidfile /var/run/naviagent/agent.pid naviagent)
6# naviagent (pid 12788) is running...
7#
8# $ ls -l /proc/`cat /var/run/naviagent/agent.pid`
9# ls: cannot access /proc/12788: No such file or directory
10
11lib=$(dirname "$0")/..
12tmp=$(mktemp -d)
13
14# TODO: rc_cache_init should be able to use tmp dir, not real root
15. $lib/rc.d/init.d/functions
16
17# first unused pid
18pid=9999999 # may not exist
19procname=testd # irrelevant
20pidfile=$tmp/agent.pid
21
22if [ -d /proc/$pid ]; then
23 echo >&2 "bad pid chosen for test, /proc/$pid exists"
24 exit 1
25fi
26
27echo $pid > $pidfile
28status --pidfile $pidfile $procname
29rc=$?
30if [ $rc = 0 ]; then
31 echo "FAIL: should not say process is running"
32 rv=1
33else
34 echo "OK: process is not running"
35 rv=0
36fi
37
38rm -rf $tmp
39exit $rv
This page took 0.082039 seconds and 4 git commands to generate.