At Your Service—Job Scheduling for Linux

A simple command-line utility for planning and managing deferred program executions.
Administering at

If your attempt to use one of the at programs produces the following diagnostic: “You do not have permission to use at”, you need to contact your local SA. Linux SAs can manage at with a fair amount of flexibility.

As you might expect, the root user has absolute permission to use the at utility and can grant the same permission to nonroot users. Two system files, /etc/at.allow and /etc/at.deny, control access to the at utility. Table 3 shows how their presence and content determines users' permission on a given system.

Table 3. Controlling User Access to at

Note that if the /etc/at.allow files exist, /etc/at.deny is completely ignored. Users are identified in both files by their Linux login, each appearing on a separate line. at does not provide a command-line utility to control the content of these files. SAs generally select their favorite text editor and manually edit the files as needed. This hardly can be considered a shortcoming, though, given the likely infrequency of change.

To summarize, nonroot users can be explicitly or implicitly assigned or denied permission to use at. SAs either can choose to manage access to at by exclusion or inclusion. Select the approach that makes the most sense for your particular installation. For example, a highly sensitive production site probably should be managed based on inclusion (i.e., nonroot users do not have permission unless it's explicitly granted—the /etc/at.allow file exists). Conversely, the Linux default configuration might be fine for most development/test environments (i.e., nonroot users have permission unless it's explicitly denied—/etc/at.allow does not exist and /etc/at.deny has zero or more entries).

Conclusion

Collectively, the at programs offer an intuitive way to manage the deferred execution of applications. Despite its simplicity and usefulness, the at utility is often ignored by Linux administrators and developers. Other less frequently used at command-line options exist that I chose not to cover here. I encourage you to review the at manual page by typing man at at your favorite shell's prompt to review all details. Also, most Linux overview books provide some coverage of at and similar programs, such as O'Reilly's Linux in a Nutshell by Ellen Siever, et. al.

Miscellaneous at Facts

Louis J. Iacona (lji@omnie.com) has been designing and developing applications on Linux/UNIX since 1982. He is currently a senior staff member of OmniE Labs, Inc. (www.omnie.com).

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Use a real job scheduling system !

Dieter Stubler's picture

Cron and At are usefull for very basic taks only.

To get real control over your jobs ans batches u should consider using a real enterprise job scheduling system.

have a look at our companies license free bicsuite job scheduling system

http://www.independit.de

Our Site is German only but answer your question in english or dutch as well

Regards
Dieter

Apache user not able to use at

Anonymous's picture

When executing from php, like:

exec('echo "echo -n \'bddasddasasddsaody \' | /bin/mail -s \'get the train\' toni ^d" | at 11:30 Today');

Then sends me a mail with an error message:

From apache@localhost.localdomain Wed Oct 11 11:24:00 2006
Date: Wed, 11 Oct 2006 11:24:00 +0900
From: Apache apache@localhost.localdomain
Subject: Output from your job 128
To: apache@localhost.localdomain

usage: ssh [-1246AaCfgkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-e escape_char] [-F configfile]
[-i identity_file] [-L [bind_address:]port:host:hostport]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-R [bind_address:]port:host:hostport] [-S ctl_path]
[-w tunnel:tunnel] [user@]hostname [command]

What am I doing wrong?!

Re: Take Command: At Your Service--Job Scheduling for Linux

DrScriptt's picture

Another very good article. I did however notice the lack of one thing that I normally see when people are referring to at vs cron. I usually see some mention of the fact that at is a one time job run, where as cron is a recurring job run. Other than that, very good. Users should be able to deduce that though. Still a very good informative column.

I like these types of articles. I tend to read them before I get started on a project as a way to procrastinate. (shame on me) The point being the articles take 10 - 15 minutes to read and play with. In that time users can learn things that will make their job easier.

DrScriptt

drscriptt@riverviewtech.net

Re: Take Command: At Your Service--Job Scheduling for Linux

Anonymous's picture

Hi - FYI, the following annotation addressed the comparison
of AT and CRON ...

http://www.linuxjournal.com/modules.php?op=modload&name=NS-lj-issues/iss...

Thanks much for the positive feedback.

--- Louis Iacona

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix