Last active
August 29, 2015 14:07
-
-
Save Gisleburt/93cdb84864020c61c6bb to your computer and use it in GitHub Desktop.
Starts / stops phantomjs webdriver on port 4444
This file contains 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/bash | |
dir=$(pwd) | |
mkdir ~/phantomjs 2> /dev/null | |
cd ~/phantomjs | |
if [ -e "phantomjs.pid" ] | |
then | |
echo Stopping webdriver | |
kill `cat phantomjs.pid` | |
rm phantomjs.pid | |
echo | |
echo | |
echo -e "\e[32mLog:\e[0m" | |
echo | |
cat output.log | |
echo | |
echo -e "\e[31mErrors:\e[0m" | |
echo | |
cat error.log | |
echo | |
else | |
echo Starting webdriver | |
phantomjs --webdriver=4444 > output.log 2> error.log & | |
echo $! > phantomjs.pid | |
fi | |
cd $dir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment