Techcuriosity
Resources
Linux
• About Linux
• Linux Vs Windows
• Linux File Permissions
• Linux Directory Structure
• Linux Basic Commands
• Linux Commands Glossary
• Linux Server Admin Commands
• Advanced Permissions in Linux
 
Web Hosting
• About Web Hosting
• Windows Web Hosting
• Linux Web Hosting
• Ruby on Rails Hosting
• Web Host - Features
• DNS propagation Delay
• Wildcard DNS
• Addon, Parked & Sub Domain
• Top Web Hosts
 
Template Editing
• About Templates
• HTML Templates
• Photoshop Template
• Word Template
• CSS Template
• Oscommerce Template
 
Bioinformatics
• Introduction
• Sequence Analysis
• Bioinformatics Tools
• Bioinformatics Databases
• Bioinformatics Software
 
Free Perl Scripts for Bioinformatics
• Scripts Library
• Dna2protein.pl
• Dnafrequency.pl
• Dna2rna.pl
• Rna2dna.pl
• Count-aminoacids.pl
• Motifs.pl
• Reverse-complement.pl
• Mutation.pl
 
Curiosity Topics
• Online Data Security
• VDS Technology
• How Website Works?
• About Hacking
 
 
Home   |   About us   |   Services   |   Forum   |   Articles   |   Tutorials   |   Contact us
 


Gateway to End all your Curiosities in Information Technology and Bio-Informatics!!.. FREE turorials for Linux, Web designing, Web template Editing, Operating systems, New technology, Bioinformatics, Bioinformatics perl scripts, Clinical research and much more curious topics you need to know.  
Your IP address is: 38.103.63.62


Find more Info related to your curiosities @ our FORUM


Web Hosting - Cron

What is a cron?
A cron is an automatic task that runs on Unix or Linux operating system.

Cronjob and Crontab

Web Hosting
-

What is a cronjob?
The cron runs on a specific intervals or at specific dates and times.
Such Jobs or tasks that is set to run automatically on the servers are know as cronjobs.

What is a cron tab?
Cron tab is a text file that contains a series of cron functions.
Each user on a shared server will have a cron tab.

What is the use of a cron?
The use of a cron or its importance to you depends on your requirements.
Here are few example usages of cron.

Example:
1. Can be used to sent email to all your customers every week.
2. Can be used to delete those inactive user accounts.
3. Can be used to check your total disk usage.
You can add your requirements to this list.

The cronjobs can run any php, cgi or shell scripts on your account at any time or intervals you specify. Most of the hosting companies allow to run cronjobs. You can find the cron settings in your control panel.

Crontab Format
The basic format of a crontab schedule consists of 6 fields.

Format syntax:
minute hour day month day-of-week command-line-to-execute

The acceptable values for each fields are:

minute 0-59 The exact minute that the command executes
hour 0-23 The hour of the day that the command executes
day 1-31 The day of the month that the command executes
month 1-12 The month of the year that the command executes
day-of-week 0-7 The day of the week that the command executes
Ie. (Sunday = 0 or 7, Monday = 1, Tuesday = 2, and so forth)

How to use crontab?
You will need SSH access to the server to run the crontab command.

crontab filename (Install filename as your crontab file)
crontab -e Edit your crontab file.
crontab -l Show your crontab file.
crontab -r Remove your crontab file.
If you don't have SSH access, you can still add the cronjob using your control panel. Contact your web host for more details.

How to set the cronjobs?
Consider you have a php file to sent emails to your customers who's payments are pending. You can add this file to your cron and make it run automatically every week or 15 days etc as per your requirements.

Lets try an example cronjob to run the php script on 15th of every month.

 
* *  15 * * /home/username/public_html/payments.php

In the above example the php file " payments.php " runs on 15th of every month.

Use of " / " (slash) and " , " (comma) in the cronjob

Use of " / "slash in crontab:
Suppose you want to run a cron every 2 hours. Use the following values.

Example:
* */2 * * * *

Use of " , " comma in crontab:
Suppose you want to run a cron on 1st and 15th of every month. Use the following values.

Example:
* * 1,15 * * *

Cron Notifications:
By default cron will sent any output from the script in an email (normally the email address associated with your hosting account) to you. You can use this notification to test your cron and also find any errors related to it.

Once you completed your tests, then you might not need to the cron emails. You can disable it on the crontab. To do so you need to redirect the output to " /dev/null ".

Example:

 
* *  15 * * /home/username/public_html/payments.php > /dev/null
-
<< Previous    |     Next >>
 
© TechCuriosity.com 2006 - 2007. All Rights Reserved.
Designed and Maintained by Telson Thomas
Techcuriosity
Website News
Sponsored Links
• Flash Templates
• Web Templates
• Flash Templates store
• Free website templates
• Free Flash Templates
 
• Advertise Here
 
Help us in our Mission
 
 
Free Tutorials
• HTML Tutorial
• PERL Tutorial
• Exim Commands
• MySQL Commands
• FTP Commands
• Shell Scripting Tutorial
 
Member Login
Username:

Password:

 
Search for Curiosity
 
 
 
Forum Curiosity Topics
• Forum Index
• Operating System's
• Web Hosting
• Programming
• Bioinformatics
• Biology & Bio-Technology
• Computer Security
• Hacking
• General Curiosity
• Jobs
 
Newsletter Signup
 
Subscribe
 
 
• Link Directory
• SiteMap