Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

at -c jobnumber will list a single job. If you want to see all of them, you might create a script like

#!/bin/bash
MAXJOB=$(atq | head -n1 | awk '{ print $1; }')
for each in $(seq 1 $MAXJOB); do echo "JOB $each"; at -c $each; done 

Probably there's a shorter way to do that, I just popped that out of my head :)

share|improve this answer
2  
at -c $(atq | cut -f 1) or for each in $(atq | cut -f 1) will avoid "Cannot find jobid" errors. (Also, Bash has for ((each=1; each<=MAXJOB; each++)) so no need for seq. If you're concerned with portability, then #!/bin/sh.) –  Dennis Williamson Aug 26 '10 at 15:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.