A script to ping the heroku app dyno and prevent it from sleeping
04 Feb 2020
herokuapp_pinger
A script to ping the heroku app dyno and prevent it from sleeping, with the notification for linux distros for success and failure
Repo
https://github.com/sharadcodes/herokuapp_pinger
SETUP
Requirements
- crontab
- notify-send
- curl
STEPS
First of all clone the repository or download it
Extract the archive file and rename the folder from
herokuapp_pinger-master
to
herokuapp_pinger
Now follow the steps
-
Place the repository folder inside the
home/${USER}/
directory.It will look like:
/home/${USER}/herokuapp_pinger/
-
Open the script
pinger.sh
insideherokuapp_pinger
folder with any text editor and replace the DUMMY_USER_NAME on the line 46 with your account name. -
Go inside the
herokuapp_pinger
folder and runchmod +x pinger.sh && mkdir logs && mkdir csv_logs
These two folders will be used to store logs.
csv_logs
folder will store logs in the form of CSV files and thelogs
folder will store them with.log
extension -
Add the hosts to the
hosts_list.txt
file insideherokuapp_pinger/script_data
folder.Every host url should be on a new line
NOTE: There should be a new empty line after the last host otherwise last entry in the file will not be read
ALSO ANY NUMBER OF HOSTS CAN BE SPECIFIED IN THE
hosts_list.txt
file -
Setup crontab like this:
* * * * * /home/your_user_name/herokuapp_pinger/pinger.sh
You should change the crontab schedule according to your needs as
* * * * *
will run the script every minute
Your logs will be inside
/home/${USER}/herokuapp_pinger/logs/
and
/home/${USER}/herokuapp_pinger/csv_logs/