stormy-weather/bin/stop.sh
2012-02-05 22:01:28 -08:00

22 lines
359 B
Bash
Executable file

#!/bin/zsh
[[ -d /web/stormy ]] && cd /web/stormy
if [[ -r pid ]]; then
PID=$(cat pid)
RETRIES=3
while [[ $RETRIES -gt 0 ]] && ps ax | grep "${PID}[ ]" >/dev/null; do
kill $PID
sleep 1
RETRIES=$((RETRIES - 1))
done
if ps ax | grep "${PID}[ ]" >/dev/null; then
kill -9 $PID
sleep 1
fi
rm pid
fi