view bin/example/pid.sh @ 675:f8813ed3d015

STUB: bin/example/pid.sh
author Jeff Hammel <k0scist@gmail.com>
date Tue, 06 May 2014 15:18:40 -0700
parents df9d5093573e
children
line wrap: on
line source

#!/bin/bash

PID=$$

echo "The PID of this shell script is ${PID}"
ps auxwww | grep ${PID}

if which tempfile
then
    PIDFILE=$(tempfile)
    echo "PID file: ${PIDFILE}"
    echo ${PID} > ${PIDFILE}
    kill $(cat ${PIDFILE})
fi

kill ${PID}