]> TLD Linux GIT Repositories - rc-scripts.git/blob - lib/makepid
- merged changes from PLD, all TLD changes and fixes are kept
[rc-scripts.git] / lib / makepid
1 #!/bin/sh
2 test -n "$PIDFILE" || { echo >&2 'Missing $PIDFILE env'; exit 1; }
3
4 # run the program, and capture pid
5 prog="$1"; shift
6 "$prog" "$@" &
7 pid=$!
8 rc=$?
9
10 # write pid to file
11 echo "$pid" > "$PIDFILE"
12 exit $rc