Thanks for sharing. I adapted your technique to separate the scheduling from the task. For example, save the following as scheduled
scheduled
#!/bin/bash # run script at scheduled time # (derived from script by Janos Gyerik # https://coderwall.com/p/eilosa/scheduling-jobs-in-unix-without-cron) # # usage: scheduled <when> <script> [args...] # e.g. scheduled '7:15' script arg1 arg2 # scheduled 'now + 5 minutes' script arg1 arg2 # also note script will execute in $PWD [[ $0 = /* ]] && script=$0 || script=$PWD/$0 when="$1" shift echo "$script '$when' $*" | at "$when" &>/dev/null $* &>/dev/null
Then use with: scheduled 'now + 10 minutes' another_script arg1 arg2 arg3
Thanks for sharing. I adapted your technique to separate the scheduling from the task. For example, save the following as
scheduled
Then use with: scheduled 'now + 10 minutes' another_script arg1 arg2 arg3