1

Running 'at' on either Debian Jessie or Raspbian Jessie, output seems to go down a black hole whatever I do. I'm wanting to capture errors, but even in the simple case of stdout I can't seem to capture output.

I'm trying, for example:

echo "curl 'http://www.example.com' > tmp.log" | at -M -t 201706042241.36

tmp.log is always empty, but the same curl not put through at produces the expected html. If I omit the -M I get nothing.

What I really want is the error output. If I try

echo "curl 'http://badbadbad.example.com' 2>&1 > tmp.log" | at -M -t 201706042241.36

I get an empty tmp.log; and if I omit -M I get an empty email. If I omit the redirects, thus:

echo "curl 'http://badbadbad.example.com'" | at -t 201706042241.36

I also get an empty email. I'd expect to see curl: (6) Could not resolve host: badbadbad.example.com

There's nothing in syslog, messages or daemon.log in /var/log. I'm running the commands as an ordinary user, not root.

at seems to hijack and discard every attempt to obtain the output from the command I'm running. Am I misunderstanding something about at?

user1247280
  • 146
  • 1
  • 3

1 Answers1

1

You are trying to pipe | the output of your commands to at instead of giving it the commands to be run at the time specified. at reads the commands from the standard input (at> prompt) or from a file (-f). Synopsis:

at [-V] [-q queue] [-f file] [-mldbv] TIME
at [-V] [-q queue] [-f file] [-mldbv] -t time_arg

Here's a good article with usage examples.

Esa Jokinen
  • 43,252
  • 2
  • 75
  • 122
  • No I'm not - I'm echo-ing the commands into `at`, which reads commands to be executed from stdin. The commands (`curl ...`) work, at the time requested, it's the capturing the output from them that's the problem. – user1247280 Jun 06 '17 at 12:01
  • My bad. I tested the last command and the result was as expected. – Esa Jokinen Jun 06 '17 at 13:05