Skip to content

Instantly share code, notes, and snippets.

@michealbenedict
Forked from ThisIsMissEm/gist:242732
Created November 2, 2010 14:55
Show Gist options
  • Save michealbenedict/659726 to your computer and use it in GitHub Desktop.
Save michealbenedict/659726 to your computer and use it in GitHub Desktop.
#! /bin/sh
CUR_DIR=$PWD
PID_FILE="$CUR_DIR/node.pid"
if [ $1 = "start" ]; then
if [ -e $PID_FILE ]; then
echo "Node.js is already running."
else
echo "Starting Node Server"
(node $2 &) > /dev/null && ps -C node | cut -d"
" -f 2 | cut -d" " -f 1 > $PID_FILE
fi
elif [ $1 = "stop" ]; then
if [ ! -e $PID_FILE ]; then
echo "Node.js is not running."
else
echo "Stopping Node Server"
kill `cat $PID_FILE`
rm -rf $PID_FILE
fi
fi
@michealbenedict
Copy link
Author

node.js starter script for linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment