Last active
April 12, 2016 11:42
-
-
Save ryross/5b7a2703020946260440 to your computer and use it in GitHub Desktop.
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 | |
# | |
# chkconfig: 35 99 99 | |
# description: Script for starting phantomjs. | |
# | |
. /etc/rc.d/init.d/functions | |
USER="phantomjs" | |
DAEMON="/usr/local/phantomjs/bin/phantomjs --webdriver=4445 --ignore-ssl-errors=true " | |
LOG_FILE="/var/log/phantomjs/main.log" | |
do_start() | |
{ | |
echo -n $"Starting PhantomJS : " | |
runuser -l "$USER" -c "$DAEMON >> $LOG_FILE &" && echo_success || echo_failure | |
RETVAL=$? | |
echo | |
[ $RETVAL -eq 0 ] | |
} | |
do_stop() | |
{ | |
echo -n $"Stopping PhantomJS : " | |
pid=`ps -aefw | grep "$DAEMON" | grep -v " grep " | awk '{print $2}'` | |
kill -9 $pid > /dev/null 2>&1 && echo_success || echo_failure | |
RETVAL=$? | |
echo | |
[ $RETVAL -eq 0 ] | |
} | |
case "$1" in | |
start) | |
do_start | |
;; | |
stop) | |
do_stop | |
;; | |
restart) | |
do_stop | |
do_start | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart}" | |
RETVAL=1 | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
replace line no 11
DAEMON="/usr/local/phantomjs/bin/phantomjs --webdriver=4445 --ignore-ssl-errors=true " (you have a white space)
with
DAEMON="/usr/local/phantomjs/bin/phantomjs --webdriver=4445 --ignore-ssl-errors=true".