Skip to content

Instantly share code, notes, and snippets.

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 dineshsprabu/9759614c007bdc61f27a to your computer and use it in GitHub Desktop.
Save dineshsprabu/9759614c007bdc61f27a to your computer and use it in GitHub Desktop.
[PhantomJS] How to make PhantomJS to restart automatically after a crash?
/*
Make sure you install phantomjs 2.0 which is really stable
Follow the below link for instructions to install it,
https://gist.github.com/dineshsprabu/543de6b41a7597967ea7
*/
>> vi /usr/bin/runphantom.sh
#!/bin/bash
bash -c '/usr/bin/phantomjs -w ; exec bash' &
>> chmod +x /usr/bin/runphantom.sh
>> crontab -e /usr/bin/runphantom.sh
@reboot /usr/bin/runphantom.sh
* * * * * /usr/bin/runphantom.sh
* * * * * sleep 1; /usr/bin/runphantom.sh
* * * * * sleep 2; /usr/bin/runphantom.sh
* * * * * sleep 3; /usr/bin/runphantom.sh
* * * * * sleep 4; /usr/bin/runphantom.sh
* * * * * sleep 5; /usr/bin/runphantom.sh
* * * * * sleep 6; /usr/bin/runphantom.sh
* * * * * sleep 7; /usr/bin/runphantom.sh
* * * * * sleep 8; /usr/bin/runphantom.sh
* * * * * sleep 9; /usr/bin/runphantom.sh
* * * * * sleep 10; /usr/bin/runphantom.sh
* * * * * sleep 11; /usr/bin/runphantom.sh
* * * * * sleep 12; /usr/bin/runphantom.sh
* * * * * sleep 13; /usr/bin/runphantom.sh
* * * * * sleep 14; /usr/bin/runphantom.sh
* * * * * sleep 15; /usr/bin/runphantom.sh
* * * * * sleep 16; /usr/bin/runphantom.sh
* * * * * sleep 17; /usr/bin/runphantom.sh
* * * * * sleep 18; /usr/bin/runphantom.sh
* * * * * sleep 19; /usr/bin/runphantom.sh
* * * * * sleep 20; /usr/bin/runphantom.sh
* * * * * sleep 21; /usr/bin/runphantom.sh
* * * * * sleep 22; /usr/bin/runphantom.sh
* * * * * sleep 23; /usr/bin/runphantom.sh
* * * * * sleep 24; /usr/bin/runphantom.sh
* * * * * sleep 25; /usr/bin/runphantom.sh
* * * * * sleep 26; /usr/bin/runphantom.sh
* * * * * sleep 27; /usr/bin/runphantom.sh
* * * * * sleep 28; /usr/bin/runphantom.sh
* * * * * sleep 29; /usr/bin/runphantom.sh
* * * * * sleep 30; /usr/bin/runphantom.sh
* * * * * sleep 31; /usr/bin/runphantom.sh
* * * * * sleep 32; /usr/bin/runphantom.sh
* * * * * sleep 33; /usr/bin/runphantom.sh
* * * * * sleep 34; /usr/bin/runphantom.sh
* * * * * sleep 35; /usr/bin/runphantom.sh
* * * * * sleep 36; /usr/bin/runphantom.sh
* * * * * sleep 37; /usr/bin/runphantom.sh
* * * * * sleep 38; /usr/bin/runphantom.sh
* * * * * sleep 39; /usr/bin/runphantom.sh
* * * * * sleep 40; /usr/bin/runphantom.sh
* * * * * sleep 41; /usr/bin/runphantom.sh
* * * * * sleep 42; /usr/bin/runphantom.sh
* * * * * sleep 43; /usr/bin/runphantom.sh
* * * * * sleep 44; /usr/bin/runphantom.sh
* * * * * sleep 45; /usr/bin/runphantom.sh
* * * * * sleep 46; /usr/bin/runphantom.sh
* * * * * sleep 47; /usr/bin/runphantom.sh
* * * * * sleep 48; /usr/bin/runphantom.sh
* * * * * sleep 49; /usr/bin/runphantom.sh
* * * * * sleep 50; /usr/bin/runphantom.sh
* * * * * sleep 51; /usr/bin/runphantom.sh
* * * * * sleep 52; /usr/bin/runphantom.sh
* * * * * sleep 53; /usr/bin/runphantom.sh
* * * * * sleep 54; /usr/bin/runphantom.sh
* * * * * sleep 55; /usr/bin/runphantom.sh
* * * * * sleep 56; /usr/bin/runphantom.sh
* * * * * sleep 57; /usr/bin/runphantom.sh
* * * * * sleep 58; /usr/bin/runphantom.sh
* * * * * sleep 59; /usr/bin/runphantom.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment