Skip to content

Instantly share code, notes, and snippets.

@gregwebs
Created March 27, 2011 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregwebs/889277 to your computer and use it in GitHub Desktop.
Save gregwebs/889277 to your computer and use it in GitHub Desktop.
wrapper script that creates a pid file
#!/bin/bash
DIR="$( cd "$( dirname "$0" )" && pwd )"
cd $DIR/..
name=`basename "$2"`
case $1 in
'start')
echo $ > ./tmp/$name.pid
exec $2 2>&1 1> ./log/$name.log
;;
'stop')
kill `cat ./tmp/$name.pid`
;;
*)
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment