#!/bin/bash

pidfile=tmp/phantomjs.pid

warn () {
  echo $1
  exit 1
}

[ -e $pidfile ] || warn "PhantomJS not started (no pid file found in tmp/)"

echo "Getting pid"
pid=$(cat $pidfile)

echo "Killing PhantomJS with pid $pid"
kill $pid

rm $pidfile
