Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Debian This forum is for the discussion of Debian Linux.


  Search this Thread
Old 05-18-2006, 10:41 PM   #1
Registered: Nov 2005
Location: Houston Texas
Distribution: Debian Sid
Posts: 379

Rep: Reputation: 31
How do I schedule a cron job?

Hello everyone!

I am not new to linux; been using Debian for about 3 or 4 years now. But I have never once made my own cron job. The need never really came up.

Today I was interested in finding out statistics about my web server (what's been going on for the past few years) so I installed awstats and got it running to my liking. Only, i have to run a command at the prompt in order to have the stats update (there's an option to allow updates from the awstats page from a browser, but i dont feel comfortable doing it this way because my stats page is publically viewable) and I can't seem to figure this cron stuff out so it does it for me.

I found this website ( ) and it taught me a few things, but I am still unclear on what exactly to do. There is specifically 3 commands I want to have run every hour (it updates stats for 3 sites), and they are as follows:

/usr/local/awstats/wwwroot/cgi-bin/ -update
/usr/local/awstats/wwwroot/cgi-bin/ -update
/usr/local/awstats/wwwroot/cgi-bin/ -update

I thought about writing a shell script to hold all 3 of these commands and putting the shell script in /etc/cron.hourly/ but I read on the above pasted link about the crontab thing... and now I am confused.

Should I set this up somehow with the crontab program? If so, how should I do it? Or, should I put a shell script in /etc/cron.hourly/ ? If so, are there any specifics I should know about before hand (like do I need to manually start the script after putting it in there, etc)?

Sorry, for making the post so long, but I like to give as many details as possible.

Here are the Server stats I am running this on:

Debian Sarge
Kernel 2.6.8-2-386
AWStats 6.5 (downloaded source from sourceforge [apt installed an incomplete awstats so it seemed] )

Any other info needed, just ask.

Thanks in advance for all your help!
Old 05-18-2006, 10:52 PM   #2
LQ Newbie
Registered: May 2006
Posts: 11

Rep: Reputation: 0
put your commands in a crontab file:

0 0-23 * * * /usr/local/awstats/wwwroot/cgi-bin/ -update

(that's all one line for one'll need to duplicate it for your other commands)

edit a text file, put that command in it, then tell cron about your text file.

Somehting like this:

#crontab myfile

use crontab -l to verify


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to schedule *interactive* task with at or cron fast_rizwaan Linux - Newbie 4 09-09-2005 07:26 PM
Trying to schedule ftp login using cron compuser Linux - General 2 06-10-2005 05:22 AM
cron jobs work fine when invoked from webmin but fail on schedule jillu Linux - Enterprise 3 01-20-2005 02:34 PM
How to schedule an automated job macaldwell Linux - Newbie 8 05-29-2004 03:07 PM
schedule job to be run at 8:00pm every night ashley75 Linux - General 22 10-24-2003 01:44 PM > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 10:56 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration