I use a script file to run some tasks using the AT command, but in the log file the date echoed is the date when I set up AT command not the execution date.
What can I do to display the actual time of end of execution?
This is my script file content:
logFILE="/tmp/loggfile.log"
if [[ -z "$1" ]]; then echo "Please specify the run time, HH:MM "; exit 1; fi
runTIME=$1
at $runTIME <<< "
echo 'Running a task....'
echo 'An other task....'
echo 'END : (`date '+%H:%M'`)' >>$logFILE
"
echo "The command was scheduled to run at $runTIME"
If I run it at 16:00 with ./script.sh 23:20
, the task will be executed at 23:20 but in the log file I get END : (16:00)
Any help will be appreciated.