Skip to content

Instantly share code, notes, and snippets.

@Antvirf
Last active December 19, 2023 05:31
Show Gist options
  • Save Antvirf/89ff778cd6612286f984d0ade6b29c2e to your computer and use it in GitHub Desktop.
Save Antvirf/89ff778cd6612286f984d0ade6b29c2e to your computer and use it in GitHub Desktop.
ghettocron: periodic tasks in a container
ghettocron() {
sleep_duration=$1
echo "[ghettocron] task interval set to $sleep_duration"
while true; do
sleep $sleep_duration
echo "[ghettocron] running task at $(date)"
curl http://localhost:8000/do_thing/ > /dev/null
done
}
ghettocron 60 & # start ghettocron
./run_server.sh # start the main app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment