Peek at `at` output before it completes

If the job has started, and you have some way of obtaining the PID of that job, you could see where at is saving the output:

$ at now
warning: commands will be executed using /bin/sh
at> sleep 10m
at> <EOT>
job 7 at Sat Jan  7 20:18:00 2017
$ pgrep sleep
7582
$ ls -l /proc/7582/fd
total 0
lr-x------ 1 muru muru 64 Jan  7 20:19 0 -> /var/spool/cron/atjobs/a0000701795998 (deleted)
lrwx------ 1 muru muru 64 Jan  7 20:19 1 -> /var/spool/cron/atspool/a0000701795998
lrwx------ 1 muru muru 64 Jan  7 20:19 2 -> /var/spool/cron/atspool/a0000701795998

As you can see, the output is saved to a temp file, which you can now check:

$ sudo tail -f /var/spool/cron/atspool/a0000701795998
Subject: Output from your job        7
To: muru

You need sudo because the containing directory is not world-accessible (at least on Ubuntu 14.04):

$ sudo namei -lx /var/spool/cron/atspool/a0000701795998
f: /var/spool/cron/atspool/a0000701795998
Drwxr-xr-x root     root   /
drwxr-xr-x root     root   var
drwxr-xr-x root     root   spool
drwxr-xr-x root     root   cron
drwxrwx--T daemon   daemon atspool
-rw------- muru     muru   a0000701795998

Tags:

Linux

Stdout

At