0

How can I save the output result of the at command to a TXT file as a logger?

What I tried was...

echo "command" | at now + 1 hour>file.txt

more unfortunately he did not save the result.

I would just like to save the results that the at command produces after finishing the output.

result that it will generate after completed

warning: commands will be executed using /bin/sh job 141 at Sat Jul 29 23:44:00 2023

Luana
  • 3
  • 2

2 Answers2

1

at outputs to stderr, you have to do echo "command" | at now + 1 hour 2>file.txt.

DallogFheir
  • 193
  • 1
  • 7
1

hi you just need to redirect the output to the file by adding

`echo "command" | at now + 1 hour>file.txt 2>&1`

or

`echo "command" | at now + 1 hour>&file.txt`
  • 0 is stdin
  • 1 is stdout
  • 2 is stderr
nisakova
  • 89
  • 6