Created
February 27, 2015 17:00
-
-
Save dylansmith/1618ae42a0df53da3ac4 to your computer and use it in GitHub Desktop.
Run nodemon and gulp serve together in a single command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PIDFILE="nodemon.pid" | |
SERVER_PATH="server/index.js" | |
CLIENT_TASK="gulp serve" | |
if [ ! -f $PIDFILE ]; then | |
nohup nodemon $SERVER_PATH >/dev/null 2>&1 & | |
PID=$! | |
echo $PID > $PIDFILE | |
echo "nodemon running as pid $PID" | |
$CLIENT_TASK | |
rm $PIDFILE | |
else | |
PID=`cat $PIDFILE` | |
echo "nodemon already running as pid $PID" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is useful for running a node backend and a client-side app (using something like BrowserSync) from a single command. You can point
npm start
at this bash script and happy days. Killing the task withctrl-c
will terminate the nodemon process as well.