view bin/example/pid.sh @ 917:372061cd29d7

web2 requires sudo for port 80
author Jeff Hammel <k0scist@gmail.com>
date Thu, 30 May 2024 18:59:32 -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}