Created
June 17, 2014 06:46
-
-
Save zhouyl/0078efc24b7c79ea8aa0 to your computer and use it in GitHub Desktop.
Jekyll Service Helper
This file contains hidden or 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/sh | |
| ACTION="@$1" | |
| if [ $ACTION = "@start" ] ; then | |
| echo "Starting Jekyll Service..." | |
| jekyll serve -w -B | |
| PID=`ps -ef | grep "jekyll" | grep -v grep | awk '{print $2}'` | |
| if [ $PID ] ; then | |
| echo -e "Jekyll service startup succeed! \033[32;49;2m[YES]\033[39;49;0m" | |
| else | |
| echo -e "Jekyll service startup failed! \031[31;49;2m[NO]\033[39;49;0m" | |
| fi | |
| elif [ $ACTION = "@stop" ] ; then | |
| echo -n "Stopping Jekyll Service..." | |
| PID=`ps -ef | grep "jekyll" | grep -v grep | awk '{print $2}'` | |
| if [ $PID ] ; then | |
| kill -9 $PID | |
| echo -e " \033[32;49;2m[YES]\033[39;49;0m" | |
| else | |
| echo -e " \033[31;49;2m[NO]\033[39;49;0m" | |
| fi | |
| elif [ $ACTION = '@restart' ] ; then | |
| $0 stop | |
| $0 start | |
| else | |
| echo "Usage: $0 [start|stop|restart]" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment