annotate bin/example/pid.sh @ 909:92f181cb772c

remove obsolete notes
author Jeff Hammel <k0scist@gmail.com>
date Fri, 12 Apr 2024 05:29:12 -0700
parents f8813ed3d015
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
674
df9d5093573e PID example
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
1 #!/bin/bash
df9d5093573e PID example
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
2
df9d5093573e PID example
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
3 PID=$$
df9d5093573e PID example
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
4
df9d5093573e PID example
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
5 echo "The PID of this shell script is ${PID}"
df9d5093573e PID example
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
6 ps auxwww | grep ${PID}
675
f8813ed3d015 STUB: bin/example/pid.sh
Jeff Hammel <k0scist@gmail.com>
parents: 674
diff changeset
7
f8813ed3d015 STUB: bin/example/pid.sh
Jeff Hammel <k0scist@gmail.com>
parents: 674
diff changeset
8 if which tempfile
f8813ed3d015 STUB: bin/example/pid.sh
Jeff Hammel <k0scist@gmail.com>
parents: 674
diff changeset
9 then
f8813ed3d015 STUB: bin/example/pid.sh
Jeff Hammel <k0scist@gmail.com>
parents: 674
diff changeset
10 PIDFILE=$(tempfile)
f8813ed3d015 STUB: bin/example/pid.sh
Jeff Hammel <k0scist@gmail.com>
parents: 674
diff changeset
11 echo "PID file: ${PIDFILE}"
f8813ed3d015 STUB: bin/example/pid.sh
Jeff Hammel <k0scist@gmail.com>
parents: 674
diff changeset
12 echo ${PID} > ${PIDFILE}
f8813ed3d015 STUB: bin/example/pid.sh
Jeff Hammel <k0scist@gmail.com>
parents: 674
diff changeset
13 kill $(cat ${PIDFILE})
f8813ed3d015 STUB: bin/example/pid.sh
Jeff Hammel <k0scist@gmail.com>
parents: 674
diff changeset
14 fi
f8813ed3d015 STUB: bin/example/pid.sh
Jeff Hammel <k0scist@gmail.com>
parents: 674
diff changeset
15
674
df9d5093573e PID example
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
16 kill ${PID}