LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   about crontab (https://www.linuxquestions.org/questions/linux-general-1/about-crontab-420221/)

shipon_97 02-28-2006 01:17 AM

about crontab
 
Friends,
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.....

timmeke 02-28-2006 05:22 AM

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).


All times are GMT -5. The time now is 09:03 AM.