Due to some well known bugs in phantomjs regardying memory leaks I am trying to create a bash script to restart my casperjs/phantomjs stuff when phantomjs crashes.....
cmd1="casperjs testCasper.js"
until $cmd1 >>$2; do
echo "Server $cmd1 crashed with exit code $?. Respawning.."
echo killall phantomjs
sleep 5
done
But somehow the phantomjs crashes dont get noticed and $cmd1 >>$2; have always the exit code of 0.
Does anyone have a working restarting casperjs script? Thanks,