Skip to content

Instantly share code, notes, and snippets.

@alexbilbie
Created June 26, 2013 13:31
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 alexbilbie/5867375 to your computer and use it in GitHub Desktop.
Save alexbilbie/5867375 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/bash
COMPASS="/usr/local/bin/compass"
case "$1" in
   ""|start)
   echo "Starting compass watch..."
   if [ -f ./cwatch.pid ]
then
echo "Sorry, but compass is already watching this folder..."
       exit 1
   fi
   nohup $COMPASS watch > /dev/null 2>/dev/null &
   echo $! > ./cwatch.pid
   echo "Done."
   ;;
   stop)
   echo "Stopping compass watch..."
   if [ -f ./cwatch.pid ]
then
xargs kill -9 < ./cwatch.pid
rm ./cwatch.pid
echo "Done."
exit 0
   fi
   echo "Sorry, but compass is not watching this folder..."
   exit 1
   ;;
   *)
   echo "Usage: cwatch {start|stop}"
   exit 1
   ;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment