Skip to content

Instantly share code, notes, and snippets.

@Gisleburt
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gisleburt/93cdb84864020c61c6bb to your computer and use it in GitHub Desktop.
Save Gisleburt/93cdb84864020c61c6bb to your computer and use it in GitHub Desktop.
Starts / stops phantomjs webdriver on port 4444
#!/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