Skip to content

Instantly share code, notes, and snippets.

@alterisian
Created May 4, 2023 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alterisian/b04b27b60705d1aa7be4c5c79d1ac6e9 to your computer and use it in GitHub Desktop.
Save alterisian/b04b27b60705d1aa7be4c5c79d1ac6e9 to your computer and use it in GitHub Desktop.
A shell script that will run the passed in command every 25 (DELAY_TIME) seconds.
#!/bin/bash
# check if parameter is passed
if [ -z "$1" ]; then
echo "Usage: $0 <command>"
exit 1
fi
# set the delay time (in seconds)
DELAY_TIME=25
# run the command every DELAY_TIME seconds and echo it
while true; do
echo "Running: $1"
$1
sleep $DELAY_TIME
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment