annotate bin/example/pid.sh @ 803:70e9f82c2443

* prime actually doesnt work; if i had a decent CI for my own software, i would have known that; but i dont * resource_filename.py even _says_ example in it. let us hope it is telling the truth
author Jeff Hammel <k0scist@gmail.com>
date Fri, 28 Oct 2016 17:00:37 -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}