-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Apoorv Vyavahare
committed
Oct 2, 2021
1 parent
6cdadcb
commit 699db11
Showing
4 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[program:self-ping] | ||
command=python3 /app/.vubuntu/assets/scripts/self-ping.py | ||
stderr_logfile=/var/log/selfping.err.log | ||
stdout_logfile=/var/log/selfping.out.log | ||
priority=995 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
from time import sleep | ||
if __name__ == "__main__": | ||
if os.getenv("NO_SLEEP") == "1": | ||
if "APP_NAME" not in os.environ: | ||
print("APP_NAME unset, terminating...") | ||
exit() | ||
app_name = os.getenv("APP_NAME") | ||
while True: | ||
try: | ||
os.system(f"curl https://{app_name}.herokuapp.com") | ||
except: | ||
print("Ping failed, retrying...") | ||
try: | ||
os.system(f"curl -s https://{app_name}.herokuapp.com") | ||
except: | ||
print("Cannot ping app, terminating...") | ||
sleep(25*60) |