2

I am very new to using at and am wondering how to display the command by a scheduled job.

postgres@dcjsn-jv2526:/opt/db/backup/postgres/dumps> atq
29      Wed Nov  2 18:55:00 2022 a postgres

I see there is a job 29 scheduled for a certain time by a certain user. Now I want to examine the command to be executed. How do I achieve that? There is nothing on this in the manpage.

2 Answers 2

1

The command

at -c 29

should do it. Note that the job file includes your full environment, so scroll down to the bottom if necessary to see the script that is executed.

The at(1) man page says:

       -c     cats the jobs listed on the command line to standard output.

You need to be superuser to examine jobs of other users though.

1
  • thks. I even read it, but just did not recognize it for what is does.
    – vrms
    Commented Nov 3, 2022 at 9:38
0

It can also be done in this way

┌──[[email protected]]-[/var/spool/at]
└─$ls /var/spool/at/
a0000101a80dd0  a0000201a80dd0  spool
┌──[[email protected]]-[/var/spool/at]
└─$cat a0000201a80dd0

3
  • How would you connect the cryptic filename with a particular at job?
    – Kusalananda
    Commented Nov 2, 2022 at 16:50
  • a0000{job_id}01a80dd0 It looks like this Commented Nov 2, 2022 at 19:35
  • You need to be superuser to do the ls of /var/spool/at I believe. OTOH, at -c 29 will work as long as you are the owner of the job. I also tried to cat the file directly and I still get permission denied even though I own it: the directory perms don't allow it. So even if you can guess the filename, you won't be able to see it unless you are the superuser.
    – NickD
    Commented Nov 2, 2022 at 20:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .