Skip to content

Instantly share code, notes, and snippets.

@mdobson
Created November 10, 2013 15:33
Show Gist options
  • Select an option

  • Save mdobson/7399598 to your computer and use it in GitHub Desktop.

Select an option

Save mdobson/7399598 to your computer and use it in GitHub Desktop.
Restart script
#!/bin/bash
PID=`pgrep -fl node`
APPDIR=/root/apps/test
if [ -n "$PID" ]
then
echo "Stopping servers : ${PID}"
echo "$PID" | awk '{ print $1 }' | xargs kill
sleep 2
fi
cd $APPDIR
echo "Starting server..."
nohup node server.js 2>&1
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment