3 # "Divide" a crontab frequency down by the first argument on the command line,
4 # logging to the second argument, and executing the remainder.
6 if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
7 echo "Usage: $0 frequency logfile command [ arguments ]" >&2
15 if [ -f "$LOGFILE" ]; then
16 LASTEXEC="$(($(tail -n 1 "$LOGFILE")+1))"
21 if [ "$LASTEXEC" -ge "$FREQUENCY" ]; then
22 echo "$* executed at $(date)" >> "$LOGFILE"
26 echo "$LASTEXEC" >> "$LOGFILE"