Home > centOS, Fedora 12 > How to crontab cronjob auto tasks setup

How to crontab cronjob auto tasks setup

How to basic cron tab? Which can automatically execute my tasks/ and i can sleep 1 hour extra?

Know this:
# show me if there is job listed
[root@example ~]# crontab -l
MAILTO=”xxx@xxx.com”
5 * * * * /usr/bin/php -v >/dev/null 2>&1
[root@example ~]#

# some how you need to delete
crontab -r

# just getting start, by this

[root@example mqueue]# crontab -e
5 * * * * /run/my/script.sh | mailx email@domain.com

Basic rule to remember:
* (minutes 0 – 59) * (hours 0 -59) * (days 1-31) * (months 1 – 12) * (day of week 0 – 6, 0=sunday) __your_command__
* = every

Example 1: Send email every 10 minutes delay
*/10 * * * * php /execute.php | mailx -s “YO humans” support@www.be
OR
0,10,20,30,40,50 * * * * php /execute.php | mailx -s “Works” support@www.be

Example 2: Every day 11:01AM send me a report
1 11 * * * php /execute.php | mailx -s “YO boss” support@www.be

Example 3: Every Friday 01:00AM send me a report
0 1 * * 5 php /execute.php | mailx -s “YO books to read till Sunday” support@www.be

Example 4: Every Monday till Friday, 09:00AM send email to bad customers, to pay invoices
0 9 * * 1-5 php /invoice.php | mailx -s “YO client, pay my bills” customer.router@www.be

Example 5: Do jobs but dont show the outputs
*/10 * * * * php /execute.pp > /dev/null

Advertisements
Categories: centOS, Fedora 12
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: