view bin/example/pid.sh @ 788:fa3ad63ec3a3

https://github.com/novas0x2a/config-files/blob/master/.gitconfig#L89
author Jeff Hammel <k0scist@gmail.com>
date Wed, 28 Sep 2016 16:42:20 -0700
parents f8813ed3d015
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}