Linux computer hardware Resources
Linux computer hardware

 

Site Map :: Search :: About Us
Contact Us :: Articles

Free Practice Exam

Free Practice Exam

Backup linux server
Linux tape backup
Linux network backup
Linux system backup
Backup data linux
Backup linux snapshot
Backup encryption linux
Linux backup to dvd
Backup linux uk
Linux window backup
Linux backup script
Backup ftp linux
Linux tape backup software
Linux cd backup
Linux backup utility

Linux backup tar
Linux oracle cluster
Access cluster free linux
Cluster linux manegment sof...
Bladecenter linux cluster
Hpc linux cluster
Linux cluster software
Download red hat linux 9
How to install red hat linu...
Red hat linux 9 tutorial
Linux help desk software
Help desk linux
Blogspot.com desk help linu...
Suse linux help
Mandrake linux help

Linux command help
Linux help forum
Google i linux microsoft op...
Microsoft office to linux
Linux microsoft software
Linux vs microsoft
Google i linux microsoft of...
Linux microsoft replace win...
Linux versus microsoft
Linux microsoft similarity
Linux microsoft project
Linux distros server
Free linux distros
Distros linux use xp
Book distros linux

Small linux distros
Live linux distros
Distros install linux
Linux router project
Linux wireless router
Router ap linux
Linux firewall router
How to setup a linux router
Linux router window xp
Linksys linux router
Linux router software
Linux computer hardware
Linux computer services
Linux computer peripheral
Linux computer storage device

 

Automating Tasks in Linux using Cron

Linux has a powerful task scheduler called Cron. Cron will allow you to run commands automatically at times specified by you. Cron is similar to the task scheduler you find in Windows. To keep track of the schedules and tasks it has to run, Cron requires a file called Crontab (CRON TABle). All the Cron schedules and tasks should be stored in this table. The Crontab files cannot be directly edited. You can add or delete entries in the crontab file using the crontab command.

What's Cron and Crontab ?

You must be wondering what the difference between cron and crontab or wether they are the same. Cron is a process or program which wakes up every minute and looks for jobs it has to execute at that moment. Crontab is the list of jobs and times at which they have to execute.

Crontab Format:

Each entry in Crontab has at least 6 fields separated by a single space. Field 1 Minute Range of Values : 0-59 Field 2 Hour Range of Values : 0-23 Field 3 Day Range of Values : 1-31 Field 4 Month Range of Values : 1-12 Field 5 Day of week Range of Values : 0-6 (Sunday being 0) Field 6 Command to Execute

Now let's see how to make a crontab entry. Let's say you want to run a script backup.sh every day at 6:00pm.The entry would look like this:

0 18 * * * /home/user/backup.sh

The asterisk (*) is used to indicate that every instance of the particular time period will be used (i.e. every hour, every weekday, etc.). I've used to full path to the script /home/user/backup.sh instead of just using backup.sh. This is because cron runs as root, you should fully qualify your path names to any scripts that will be run. Let's see some more examples :

* Let's run the script printinvoices.sh every sunday at 12:45pm.

45 12 * * 0 /home/account/printinvoices.sh

* How about clearaccount.sh every month beginning at 1:32am ?

21 1 1 * * /home/accont/clearaccount.sh

* Let's see how to schedule a task to run only on weekdays(monday to friday)

0 10 * * 1-5 /home/account/cleartemp.sh

Adding and Editing Entries in Crontab and Now that you know how crontab entries are formated, it's time to put some of your entries into the crontab list. To do this, you can use the crontab command. By specifying the -e option, you'll be taken to the default text editor to add and edit your crontab list. [crontab -e]

Another method of manipulating your crontab entries is to create and save a text file with your crontab entries. You can load your list into crontab by using the following command: [crontab mycrontablist] where mycrontablist is the file containing your entries.

Viewing Crontab: [crontab -l]

You can view your current crontab list by specifying the -l option. Issuing this command will print out a list of all your current jobs in the crontab list

Removing Crontab: [crontab -r]

The -r option removes your current crontab file. Issuing this command will empty the contents of the current user's crontab file

Output from cron

Usually the output of cron gets mailed to the owner of the process or the person or email id specified in the MAILTO variable. To set the MAILTO variable, you'll have to add the following command to the top of your crontab : MAILTO="your_email_address@domain.com"

If you have a command that is run frequently, and you don't want the output to be emailed each time, you can redirect the output to a log file cmd >> log.file, so your job would be something like this.

0 18 * * * /home/user/backup.sh>>log.file

If you don't want any output at all, you can redirect the output to a null file : cmd>>/dev/null

0 18 * * * /home/user/backup.sh>>/dev/null
 

About the Author

Vinu Thomas is a consultant on Web design and Internet Technologies. His website is http://www.vinuthomas.com. You can read more articles on Linux @ http://www.vinuthomas.com/sections-listarticles-6.html


 Additional Linux computer hardware Resources

AnandTech: your source for hardware analysis and news
Independent hands-on reviews of computer hardware such as motherboards, graphic cards, and CPUs.

PC Mechanic
Offers Linux and Windows tutorials, as well as news articles, downloads, forums and technical-support services.

Linux Computer Hardware | Your Information Authority and Linux Compute
Linux Computer Hardware facts.. Did you know that Linux Computer Hardware Featured Linux Computer Hardware Article for Monday, 08 August 2005 09:24 am Computer Network Designing Computer ...

HardwareCentral - Your source for in-depth computer hardware info.
HardwareCentral is the #1 Hardware Information Resource on the 'Net. Featuring over 600 pages of Hardware information, including advice on System ...

HP United States - Welcome
A leading manufacturer of Linux servers.

LinuxHardware.org
... Linux workstation, I will take you through some of the special construction that had to be done to accommodate some of the special hardware ... 1GB modules for computer enthusiasts ...

linux computer hardware
...all information about linux computer hardware, where to find all answers about linux computer hardware.....2004 © linux-at-home.net.....linux computer hardware.. ad links: surgical penis ...

NOVELL: Worldwide
Hardware die vom Linux Distributor verkauft wird. Linux ist vorinstalliert.

Linux.com - Hardware
... Updated: Jul 2005. Lists most of the hardware supported by Linux and helps you locate any necessary drivers ... to view DVD movies on a Linux computer with a DVD drive ...

computer hardware - computer hardware manufacturers, computer hardware
...free computer peripherals discounts, printers, pda's, monitors for less, reduced computer.....Linux computer. Iomega offers a variety of Zip drive connectivity options to fit ...

Linux on Laptops
Since 1995, a resource for documentation about installing and running the Linux operating system on laptop and notebook computer hardware.

Computer hardware (Linux Reviews)
Linux Reviews Dictionary Computer hardware. en.wikipedia.org. en.wikipedia.org - Computer hardware : Computer_hardware. Hardware comprises all of the physical parts of a ...

MediaSell
...Whether you need to get Linux running on an existing computer, upgrade a Linux computer, or buy a completely new.....Smith how to avoid the hardware thats less than ideal for use with ...

Linux Terminal Server Project
Deploying Linux on the Desktop with LTSP ... at the Iowa City VA Medical Center, for a cutting-edge strategy to recycle computer hardware using...

LinuxElectrons - linux with a hardware slant
Your scene for linux hardware with breaking news coverage of hardware and software, complete with reviews, howto's, forum's and features NO SPIN. ... the availability of MontaVista Linux ...

Other Recommended Linux computer hardware Links

Linux backup tar
Linux oracle cluster
Access cluster free linux
Cluster linux manegment sof...
Bladecenter linux cluster
Hpc linux cluster
Linux cluster software
Download red hat linux 9
How to install red hat linu...
Red hat linux 9 tutorial
Linux help desk software
Help desk linux
Blogspot.com desk help linu...
Suse linux help
Mandrake linux help

   
   

Site Map :: Search :: About Us :: Contact Us :: Articles

© http://www.pcinform.com/Linux All Rights Reserved