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

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState