Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Debian GNU/Linux Reference Guide
Prev Home Next

8.6.27 Schedule activity (cron, at)

Use cron and at to schedule tasks under Linux. See at(1), crontab(5), crontab(8).

Run the command crontab -e to create or edit a crontab file to set up regularly scheduled events. Example of a crontab file:

     # use /bin/sh to run commands, no matter what /etc/passwd says
     SHELL=/bin/sh
     # mail any output to `paul', no matter whose crontab this is
     MAILTO=paul
     # Min Hour DayOfMonth Month DayOfWeek command (Day... are OR'ed)
     # run at 00:05, every day
     5  0  *  * *   $HOME/bin/daily.job >> $HOME/tmp/out 2>&1
     # run at 14:15 on the first of every month -- output mailed to paul
     15 14 1  * *   $HOME/bin/monthly
     # run at 22:00 on weekdays(1-5), annoy Joe. % for newline, last % for cc:
     0 22 *   * 1-5 mail -s "It's 10pm" joe%Joe,%%Where are your kids?%.%%
     23 */2 1 2 *   echo "run 23 minutes after 0am, 2am, 4am ..., on Feb 1"
     5  4 *   * sun echo "run at 04:05 every sunday"
     # run at 03:40 on the first Monday of each month
     40 3 1-7 * *   [ "$(date +%a)" == "Mon" ] && command -args

Run the at command to schedule a one-time job:

     $ echo 'command -args'| at 3:40 monday

Debian GNU/Linux Reference Guide
Prev Home Next

 
 
  Published under the terms of the GNU General Public License Design by Interspire