Skip to content

Instantly share code, notes, and snippets.

@andresgutgon
Created October 26, 2012 08:07
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save andresgutgon/3957558 to your computer and use it in GitHub Desktop.
Save andresgutgon/3957558 to your computer and use it in GitHub Desktop.
#!/bin/bash
COMPASS="/var/lib/gems/1.8/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