Presentation is loading. Please wait.

Presentation is loading. Please wait.

Presented by Dave Mawdsley, DACS Member, Linux SIG February 20, 2013

Similar presentations


Presentation on theme: "Presented by Dave Mawdsley, DACS Member, Linux SIG February 20, 2013"— Presentation transcript:

1 Presented by Dave Mawdsley, DACS Member, Linux SIG February 20, 2013
Beginner's Guide to 'at' (scheduling one-time tasks) Presented by Dave Mawdsley, DACS Member, Linux SIG February 20, 2013

2 What Does 'at' Do? 1 at is a one-time scheduling utility that activates at a particular time and date. When activated, it can execute a set of commands that can manage backups, shut the computer down, and so forth. The utility can be activated relative to 30 minutes later than the present moment with a command such as: at now + 30 minutes or execute a file my_script in three hours: at -f my_script now + 3 hours One nice advantage of the at command is that if the computer is turned off at the time it should have activated, the at command will pickup and execute when computer is restarted. Unfortunately, this won't happen with specific crontab jobs. For example: * ls -l is a cron job set to execute ls -l on March 3rd at 8:30 AM, but if the computer is off at 8:29 AM that day, it will only work again--next year!

3 What to Check First 2 Because at tasks execute in the future, it's a good idea to make sure that the environment on your computer is ready for them. Using the command line, issue the following command: cd /etc; ls -l at* to see if at.deny and at.allow exist. (at.allow may not exist.) Next, issue the following command to see the denied users list: sudo cat at.deny at.allow is required for Fedora, but it is not the default in Ubuntu. Next try a simple test to see at in action.

4 Test to See 'at' in Action 3 Using the command line I typed (blue, responses in black): at 11:49am Jan 18 warning: commands will be executed using /bin/sh at> cd Desktop at> touch Output1; date > Output1 Next I typed CTRL+D to exit the at command listing and automatically save the task. The output next showed: at> <EOT> job 12 at Fri Jan 18 11:49: Last, to verify that the task is ready to be performed, I typed: at -l 12 Fri Jan 18 11:49: a madmod

5 4 The Output and a Remark To see the output after the at job occurred, I typed: cat Desktop/Output1 Which yielded the output: Fri Jan 18 11:49:00 EST 2013 Remark: the at command can be set by any allowed user or root. However, Issuing the command using root is probably preferable when the commands in the list require root privileges such as: shutdown -h now

6 5 A Few Other 'at' Options Look at job number 12 (the c is to cat the job): at -c 12 List all the jobs (the q is to show the queue): atq or at -l (the -l is an alias for atq) Remove job 12 (the rm is to remove): atrm 12

7 6 Final Thoughts on 'at' My business computer is on early in the day and is turned off at night. So crontab tasks generally work well. I set them to run during the part of the day that the computer is on. For critical one-time tasks that I must not forget—usually in the near future—at tasks are preferred. However, my fileserver is on only when I know that backups will be needed from the computers in the house. This tends to be very late in the day, though it varies somewhat, and some days the fileserver isn't on at all. Tasks that need to be done at the server such as making a server archive or making a clone of the hard disk is better done with at tasks so those reminders to my fileserver's desktop won't be lost.

8 This OpenOffice.org Presentation 'usingat.odp' can be downloaded from
Beginner's Guide to 'at' (scheduling one-time tasks) This OpenOffice.org Presentation 'usingat.odp' can be downloaded from


Download ppt "Presented by Dave Mawdsley, DACS Member, Linux SIG February 20, 2013"

Similar presentations


Ads by Google