I have a Debian box with some jobs scheduled using at
. I know I can list the jobs with their times using atq
, but is there any way to print out their contents, apart from peeking into /var/spool/cron/atjobs
?
I have a Debian box with some jobs scheduled using at
. I know I can list the jobs with their times using atq
, but is there any way to print out their contents, apart from peeking into /var/spool/cron/atjobs
?
at -c jobnumber
will list a single job. If you want to see all of them, you might create a script likeProbably there's a shorter way to do that, I just popped that out of my head :)
Building upon previous responses, this lists each job's line from
atq
showing job number and scheduled time and then just the command to be run, sorted chronologically (rather than job number):producing, e.g.
A much simpler approach:
You could also look at each one in
less
in turn, which might be clearer:I've created command
atqc
for this ("atq with command"). A bash function. Run this on the bash command line (terminal command). Or put it in the~/.bashrc
file to make it available for later:Test it:
That works for RHEL7 with
at -V
version 3.1.13.Ubuntu 16.04 with
at -V
version 3.1.18 has a slightly different output format inat -c N
, so on my Ubuntu server this works:Here is an alternative approach, similar to the others in this thread but using awk more:
To do a "dry run" and see what would be executed, simply remove the "| bash" part from the end.