Skip to content

Instantly share code, notes, and snippets.

@ashnur
Created September 19, 2012 06:13
Show Gist options
  • Select an option

  • Save ashnur/3747972 to your computer and use it in GitHub Desktop.

Select an option

Save ashnur/3747972 to your computer and use it in GitHub Desktop.
simple debian init script
#!/bin/bash
DIR=/home/ashnur/www/docpad
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/home/ashnur/.nvm/v0.8.4/bin
NODE_PATH=/home/ashnur/.nvm/v0.8.4/lib/node_modules
NODE=/home/ashnur/.nvm/v0.8.4/bin/node
test -x $NODE || exit 0
function start_app {
`docpad run --env production 1>>"$DIR/../logs/docpad.log" 2>&1 &`·
echo $! > "$DIR/../pids/docpad.pid"
}
function stop_app {
kill `cat $DIR/../pids/docpad.pid`
}
case $1 in
start)
start_app ;;
stop)
stop_app ;;
restart)
stop_app
start_app
;;
*)
echo "usage: docpad {start|stop}" ;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment