Created
January 28, 2026 10:25
-
-
Save ad2ien/f3abd8e481db6718d7362a2c0973f475 to your computer and use it in GitHub Desktop.
Start stuff needing connection at boot (@reboot in crontab)
This file contains hidden or 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
| #!/bin/bash | |
| # Start stuff needing connection at boot (@reboot in crontab) | |
| set -e | |
| TIMEOUT_INTERVAL_S=5 | |
| echo "Start frpc" | |
| do_stuff(){ | |
| # cd | |
| # command >> stuff.log | |
| } | |
| while true; do | |
| if ping -c 1 bandcamp.com/ &> /dev/null | |
| then | |
| echo "Internet connection ok" | |
| break | |
| else | |
| echo "No connection..." | |
| fi | |
| sleep $TIMEOUT_INTERVAL_S | |
| done | |
| while ! do_stuff; do | |
| echo "Stuff failed, retrying in $TIMEOUT_INTERVAL_S seconds..." | |
| sleep $TIMEOUT_INTERVAL_S | |
| done | |
| echo "end stuff process" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment