Using the Unix "at" command interactively

 

The "at" command allows you to schedule a job to be run at a certain date and time. Useful for running one off unattended scripts. Scripts you want to run regularly you should put in crontab. The man pages give a description but .....

This is not documented in any of the man pages I have ever read but the best way of using the Solaris "at" command is interactively.

invoke an "at prompt" for the date and time you want. If you specify just a time the job will be executed next day.

$ at 03:00

(you then get an "at" prompt)

at> /export/home/davy/scripts/get-new-patches

at> /export/home/davy/scripts/install-new-patches

at> CTRL +D (control-D to exit)

you will then get your job ID number

at> <EOT>
commands will be executed using /sbin/sh
job 965872800.a at Thu Aug 10 03:00:00 2000
$

 

The command atq shows you the jobs in the queue waiting to be run their ID's and priority.

The jobs are also in /var/spool/cron/atjobs which is where you will also find the output of any scripts if you didn't redirect elsewhere, say downloaded files (first place to look for lost files from "at"jobs).

The stdout of the job will be mailed to the user that created it after completion.

Remember:

Check file permissions one more time before you go home (your file has to be executable for the user that created the at job).

Use absolute path names with "at" jobs to be sure.

Check you have enough disk space if you are doing unattended downloads.