My scheduled script isn't working this is what I've tried: I have a b.sh file with the following:
#! /bin/bash
echo "hello, $USER"
I want to try using the "at" command for a scheduled send in 1 minute as follows echo b.sh | at now + 1 minute
but nothing is executing anywhere...
I checked the queue with atq
first and confirmed it was waiting for the next minute to execute, but one minute later, nothing was happening anywhere.
Is it executing somewhere and I'm not looking in the right place? I was under the impression it should execute in the terminal before my eyes...
In fact, the process used with at
command is executed by atd
daemon.
atd
daemon is not attached to your terminal.
But, if you want to print messages, you have two solutions:
exec > /path/to/my_log/file.log
exec 2>&1
Execute your at
command like this:
echo "FATHER_TTY=$(tty) ./b.sh" | at now + 1 minute
And, the content of your ./b.sh
script:
#! /bin/bash
exec > "${FATHER_TTY}"
exec 2>&1
echo "hello, $USER"