'at' command intended behaviour? Launching each commands instead of scheduling

I'm trying to schedule the execution of some programs. I'm using this command:

./tests.o | at 15:00&

If I understood correctly, the intended behaviour was to delay execution until 15:00. However if I run top as soon as I launch the above command, I can see already tests.o eating CPU time.

Since I need to launch multiple tests on a shared resources I am wondering how to correctly use "at"?

What am I doing wrong?


Solution 1:

at reads commands from standard input. What you are doing is running ./tests.o and feeding its output string(s) as command(s) for at to schedule. Also, there is no need for the trailing &, as at returns immediately.

What you need is:

echo ./tests.o | at 15:00

or:

at 15:00 <<< ./tests.o

You will need to use quoting if you want the scheduled command to use redirection or other shell functions, eg:

at 15:00 <<< './tests.o > tests.log'