Trying here to modify a job from at command.

Any idea on how to do it?

Already managed to list it, delete, and execute, but can't modify it.


If you just need to fix a typo in the shell language itself, look for your job in directory /var/spool/cron/atjobs:

# type -p date | at 1430
warning: commands will be executed using /bin/sh
job 2 at Fri Aug 23 14:30:00 2019
# atq
2       Fri Aug 23 14:30:00 2019 a root
# ls /var/spool/cron/atjobs/
# cat /var/spool/cron/atjobs/a00002018e67ea
# atrun uid=0 gid=0
# mail root 0
umask 22
LESSCLOSE=/usr/bin/lesspipe\ %s\ %s; export LESSCLOSE
LANG=en_US.UTF-8; export LANG
LESS=-X; export LESS
EDITOR=/usr/bin/vi; export EDITOR
USER=root; export USER
PAGER=/usr/bin/less; export PAGER
PWD=/root; export PWD
HOME=/root; export HOME
XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop; export XDG_DATA_DIRS
MAIL=/var/mail/root; export MAIL
SHLVL=1; export SHLVL
LOGNAME=root; export LOGNAME
PATH=/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/root/bin; export PATH
LESSOPEN=\|\ /usr/bin/lesspipe\ %s; export LESSOPEN
cd /root || {
         echo 'Execution directory inaccessible' >&2
         exit 1

Regarding modifying the date/time the job is to run, that is encoded into the filename for the job. If we suppose:

# ls  -ltr /var/spool/cron/atjobs/
total 12
-rwx------ 1 root daemon 1054 Aug 23 13:58 a00002018e67ea*
-rwx------ 1 root daemon 1054 Aug 23 14:03 a00003018e67eb*
-rwx------ 1 root daemon 1054 Aug 23 14:03 a00004018e67e9*
# atq
2       Fri Aug 23 14:30:00 2019 a root
3       Fri Aug 23 14:31:00 2019 a root
4       Fri Aug 23 14:29:00 2019 a root

Then the filename a00003018e67eb within the /var/spool/cron/atjobs directory is constructed thus:

  • a is the "queue identifier" (the a in the atq listing)
  • 00003 is a (hex) representation of the job number, 3
  • 018e67eb is the hex representation of the time the job is to run

The hex value 018e67eb is 26109931 in decimal. That appears to be minutes past the epoch since 26109931 * 60 = 1566595860 and 1566595860 seconds past the epoch is Friday, August 23, 2019 2:31:00 PM here in my time zone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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