Skip to content

Instantly share code, notes, and snippets.

@ad2ien
Created January 28, 2026 10:25
Show Gist options
  • Select an option

  • Save ad2ien/f3abd8e481db6718d7362a2c0973f475 to your computer and use it in GitHub Desktop.

Select an option

Save ad2ien/f3abd8e481db6718d7362a2c0973f475 to your computer and use it in GitHub Desktop.
Start stuff needing connection at boot (@reboot in crontab)
#!/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