Crontab help
Moderators: Developers, Moderators
Crontab help
Thanks to Witness and rony--the poller is now working (I had a typo in my rrdtool path)--sorry I wasted your time on that one.
I have one more issue and then I am up and running. The poller will run only if I issue from command line. The entry in my crontab is not working(will not run automatically).
Here is my complete crontab:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# 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
*/5****cactiuser /www/php/bin/php /www/htdocs/cacti/poller.php > /dev/null 2>&1
Witness told me in another post to change output from /dev/null. Do I just change to /usr/local/somefile.txt? Do I leave the 2>&1? Thank you so much.
If I issue /www/php/bin/php /www/htdocs/cacti/poller.php from command--poller will work.
David
I have one more issue and then I am up and running. The poller will run only if I issue from command line. The entry in my crontab is not working(will not run automatically).
Here is my complete crontab:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# 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
*/5****cactiuser /www/php/bin/php /www/htdocs/cacti/poller.php > /dev/null 2>&1
Witness told me in another post to change output from /dev/null. Do I just change to /usr/local/somefile.txt? Do I leave the 2>&1? Thank you so much.
If I issue /www/php/bin/php /www/htdocs/cacti/poller.php from command--poller will work.
David
- rony
- Developer/Forum Admin
- Posts: 6022
- Joined: Mon Nov 17, 2003 6:35 pm
- Location: Michigan, USA
- Contact:
Well, I wouldn't run the poller as root, and I wouldn't edit the system crontab.
I would run the poller as another user, for example, cactiuser. To edit the cactiuser crontab I would use, as root:
This will allow me to edit the crontab for the cactiuser user. Then I would put the following line in the crontab.
Making sure that the cactiuser has permissions to excute php and to read and write the /www/htdocs/cacti/log and /www/htdocs/cacti/rra directories.
As for logging the output of the poller to a file, well, that is personal choice. I wouldn't as durning a situation where I want see that output, I can simply run the poller manually from the command line and see that output for myself.
I would run the poller as another user, for example, cactiuser. To edit the cactiuser crontab I would use, as root:
Code: Select all
crontab -e -u cactiuser
Code: Select all
*/5**** /www/php/bin/php /www/htdocs/cacti/poller.php > /dev/null 2>&1
As for logging the output of the poller to a file, well, that is personal choice. I wouldn't as durning a situation where I want see that output, I can simply run the poller manually from the command line and see that output for myself.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
Rony,
Sorry about this--I am new to linux and need to be babied.
To follow your instructions, do I type
crontab -e -u cactiuser in the command line. When I do this,
Here is what I get:
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/tmp/crontab.XXXX1pO3Gh" 0L, 0C
Does this change me to cactiuser?? I don't know where/how to edit crontab for cactiuser. Thank you for your patience.
David
Sorry about this--I am new to linux and need to be babied.
To follow your instructions, do I type
crontab -e -u cactiuser in the command line. When I do this,
Here is what I get:
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/tmp/crontab.XXXX1pO3Gh" 0L, 0C
Does this change me to cactiuser?? I don't know where/how to edit crontab for cactiuser. Thank you for your patience.
David
- fmangeant
- Cacti Guru User
- Posts: 2345
- Joined: Fri Sep 19, 2003 8:36 am
- Location: Sophia-Antipolis, France
- Contact:
Hi
you can either run "crontab -e -u cactiuser" as root, or "crontab -e" as cactiuser.
If your editor is VI, just type 'i', followed by
and then quit VI with ":x"
you can either run "crontab -e -u cactiuser" as root, or "crontab -e" as cactiuser.
If your editor is VI, just type 'i', followed by
Code: Select all
*/5 * * * * /usr/bin/php /www/htdocs/cacti > /dev/null 2>&1
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
-
- Cacti User
- Posts: 52
- Joined: Fri May 06, 2005 7:39 am
- Location: france
- Contact:
I now get this error:
[root@fedora1 ~]# crontab -e -u cactiuser
no crontab for cactiuser - using an empty one
crontab: installing new crontab
"/tmp/crontab.XXXXBGQ7Y7":1: bad minute
errors in crontab file, can't install.
Do you want to retry the same edit? y
crontab: installing new crontab
Any suggestions.
Thanks
[root@fedora1 ~]# crontab -e -u cactiuser
no crontab for cactiuser - using an empty one
crontab: installing new crontab
"/tmp/crontab.XXXXBGQ7Y7":1: bad minute
errors in crontab file, can't install.
Do you want to retry the same edit? y
crontab: installing new crontab
Any suggestions.
Thanks
- rony
- Developer/Forum Admin
- Posts: 6022
- Joined: Mon Nov 17, 2003 6:35 pm
- Location: Michigan, USA
- Contact:
What are you trying to put in the crontab?
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
- fmangeant
- Cacti Guru User
- Posts: 2345
- Joined: Fri Sep 19, 2003 8:36 am
- Location: Sophia-Antipolis, France
- Contact:
Some (old) cron daemons dont know "*/5". Try 0,5,10,15,20,25,30,35,40,45,50,55 instead.
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
- rony
- Developer/Forum Admin
- Posts: 6022
- Joined: Mon Nov 17, 2003 6:35 pm
- Location: Michigan, USA
- Contact:
Code: Select all
*/5 * * * * /www/php/bin/php /www/htdocs/cacti/poller.php > /dev/null 2>&1
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
- rony
- Developer/Forum Admin
- Posts: 6022
- Joined: Mon Nov 17, 2003 6:35 pm
- Location: Michigan, USA
- Contact:
That should work, make sure you do not have a space in front of the line.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
OK, patience--I still am having problems.
When I am logged in as cactiuser, I type cactiuser -e in terminal, which takes me to vi.
I type 'i', then:
*/5**** /www/php/bin/php /www/htdocs/cacti/poller.php > /dev/null 2>&1
When I attempt to exit I get this error:
"/tmp/crontab.XXXXMZxUlS":1: bad minute
errors in crontab file, can't install.
Do you want to retry the same edit?
I also tried the 0,5,10,15,20,25,30,35,40,45,50,55 and got bad hour.
Again, I know it is something stupid, but I can't see it. Appreciate the help.
When I am logged in as cactiuser, I type cactiuser -e in terminal, which takes me to vi.
I type 'i', then:
*/5**** /www/php/bin/php /www/htdocs/cacti/poller.php > /dev/null 2>&1
When I attempt to exit I get this error:
"/tmp/crontab.XXXXMZxUlS":1: bad minute
errors in crontab file, can't install.
Do you want to retry the same edit?
I also tried the 0,5,10,15,20,25,30,35,40,45,50,55 and got bad hour.
Again, I know it is something stupid, but I can't see it. Appreciate the help.
-
- Cacti User
- Posts: 52
- Joined: Fri May 06, 2005 7:39 am
- Location: france
- Contact:
Who is online
Users browsing this forum: No registered users and 1 guest