Visit the LQ Articles and Editorials section
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 02-28-2006, 02:17 AM   #1
Registered: Oct 2005
Location: Bangladesh
Posts: 471

Rep: Reputation: 30
Question about crontab

I have 2 questions about Crontab .

1) In /etc folder , i find 4 folder (cron.hourly , cron.daily, cron.weekly,cron.monthly). But i need a cron folder in minute i.e. cron.minute . If i make this folder and create a script into it , then is it working or not?

2) my 2nd question is :

In "crontab -e" i write the following line for generating my "MRTG" page 5 minutes after :

*/5 * * * * /usr/bin/mrtg /etc/mrtg/mymrtg.cfg --logging /var/log/mrtg.log

But i have no clear conception about the line , i.e., why i use "/usr/bin/mrtg /etc/mrtg/mymrtg.cfg "? why not just write "/etc/mrtg/mymrtg.cfg" ?

Is any process or rules to writing this line ? plz help me.....
Old 02-28-2006, 06:22 AM   #2
Senior Member
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
1) No, unless you alter /etc/crontab to make all items in /etc/cron.minutely run every minute.
I however strongly recommend against running a job each minute, as this can slow down your system.
Which job were you trying to run exactly?

2) For formats of the lines, you can check out:
man crontab
man 5 crontab
man 8 crontab (on some systems)
man cron
Normally, you can put any shell command you want at the end of each line.
If you just wrote "/etc/mrtg/mymrtg.cfg", then that must be an executable file (ie a program or a shell script you can run). If it's a plain config file, then executing it won't accomplish anything useful.
For all shell commands, you need to use a syntax like so:
command_name parameters
where command_name is the name of the executable program and parameters can contain anything, like names of config files, command options, input or output files the program is supposed to use or create, etc. The exact command syntax depends on the actual command. For some, you can access their man pages for more information on the syntax.

To answer your question: "/usr/bin/mrtg" is the actual program (command_name), so it needs to be specified before all parameters (like the config in /etc/mrtg and the --logging option).


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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
crontab Xris718 Linux - General 5 08-15-2005 02:03 PM
crontab -e hoover93 Linux - Newbie 2 08-06-2004 05:05 PM
system-wide crontab in /etc/crontab ner Linux - General 2 11-18-2003 01:35 PM
Crontab Gorbachov Linux - Software 3 09-26-2003 05:40 PM
crontab alaios Linux - General 5 05-01-2003 04:26 PM

All times are GMT -5. The time now is 11:43 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration