Skip to content

Instantly share code, notes, and snippets.

@allex
Last active August 29, 2015 14:04
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save allex/965f3e1a0876592db33f to your computer and use it in GitHub Desktop.
Save allex/965f3e1a0876592db33f to your computer and use it in GitHub Desktop.
#!/bin/sh
# ================================================
# Description: Run compass watch in background
# GistID: 965f3e1a0876592db33f
# GistURL https://gist.github.com/allex/965f3e1a0876592db33f
# Author: Allex Wang (allex.wxn@gmail.com)
# Last Modified: Tue Dec 09, 2014 12:12PM
# ================================================
firstArg="$1"
if [ "$firstArg" != "-s" ]; then
dir=$firstArg
else
shutdown=1
fi
[ -n "$dir" ] || dir=`pwd`
dir=`cd -P -- "$dir" && pwd -P`
pidfile="$dir/.sass.pid"
logfile="$dir/.sass.log"
if [ -f $pidfile ]; then
kill -9 `cat $pidfile` >/dev/null 2>&1
rm -rf $pidfile
fi
[ $shutdown ] && { echo 'shutdown!'; exit 0; }
set -e
if [ ! -f "$dir/config.rb" ]; then
echo "config.rb not found. please run 'compass init' first."
exit 0;
fi
pushd $dir >/dev/null
compass compile "$dir" >$logfile 2>&1&
nohup compass watch >>$logfile 2>&1&
echo $! >$pidfile
echo "compass watch success, pid: $!";
popd >/dev/null
@gnps
Copy link

gnps commented May 27, 2015

While getting errros, it is getting stop.
Even while errors, I do want to restart / do not stop compiling even If it has errors.
any clues, please...

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