Skip to content

Instantly share code, notes, and snippets.

@rafaelbrandao
Created January 3, 2013 05:15
Show Gist options
  • Save rafaelbrandao/4441014 to your computer and use it in GitHub Desktop.
Save rafaelbrandao/4441014 to your computer and use it in GitHub Desktop.
Example of usage: sh ./scheduled-task.sh 22:30 "echo 'hello'"
TRIGGER_TIME=$1
CMD=$2
echo "Scheduled run of \"$CMD\" at $TRIGGER_TIME..."
while :
do
NOW=`date +"%H:%M"`
if [ $NOW = $TRIGGER_TIME ]; then break; fi
sleep 30
done
$CMD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment