#!/bin/sh # Should be added to cron like this: # * * * * * /home/enikesha/quicklisp/local-projects/chatikbot/kill-stale.sh DIR="$(dirname "$0")" test `find "$DIR/.watchdog" -mmin +2` || exit # Kill exising process pid=`lsof -iTCP:4016 -sTCP:LISTEN -t` && kill $pid