What the meaning of this command?

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
Snowprint
Posts: 11
Joined: Fri Oct 27, 2006 4:06 am

What the meaning of this command?

Post by Snowprint »

crontab -e

When I add the line
*/5 * * * * cactiuser php /var/www/cacti/poller.php > /dev/null 2>&1
to the editor, what will happen?

how to save the file? Just cover the exsiting under /etc/ ?

Anybody can help me?

The server is ubuntu.

Many thanks!
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Yep, you should add this line to all previously existing lines of /etc/crontab and save. But pay attention: on rpm installations, there may exist /etc/cron.d/cacti with the same line. Only one of them must exist.
This will request the crond to execute the cacti poller every 5 mins.
Reinhard
Snowprint
Posts: 11
Joined: Fri Oct 27, 2006 4:06 am

Post by Snowprint »

Thanks for your reply.

But I want to know when I exit the eidtor of "crontab -e", the screen tell me "crontab: installing new crontab".

While I vim /etc/crontab

I can't get that job.

And also, the format is as this:

17 * * * * root run-parts --report /etc/cron.hourly

not the same with my command.

Could you explain it to me? I am not very clear on this...
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Snowprint wrote:But I want to know when I exit the eidtor of "crontab -e", the screen tell me "crontab: installing new crontab".
Doing so, will create a new crontab for the user currently logged in. It is normal, that this reply is given. But this is required only, if you're logged in as cactiuser and want to create a crontab entry for that very user. This _is_ possible, but not recommended.
While I vim /etc/crontab ....
Please see my /etc/crontab, if configured for cacti as an example how it should look like

Code: Select all

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

# cacti
*/5 * * * * cactiuser /usr/bin/php /var/www/html/cacti/poller.php > /var/www/html/cacti/log/poller.log 2>&1
Make your crontab looking like that
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest