Crontab help

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

Moderators: Developers, Moderators

davidh
Posts: 22
Joined: Wed Oct 20, 2004 2:51 pm
Location: Laurens, SC

Post by davidh »

John,

I haven't tried your fix yet.

Before I try--I create another file in gedit with my "command to execute". I then issue the

crontab -u <user> <path_to_file>/<file_to_use_for_crond>?

Thanks for your help
john le lardon
Cacti User
Posts: 52
Joined: Fri May 06, 2005 7:39 am
Location: france
Contact:

Post by john le lardon »

yes but you can use the /etc/crontab file and add your command at the end of file (with gedit ) .
:)
[/code]
davidh
Posts: 22
Joined: Wed Oct 20, 2004 2:51 pm
Location: Laurens, SC

Post by davidh »

OK--I'm still stumbling along.

I know now that the problem was that I didn't have a crontab for my cactiuser account.

I have that now and this is what is in there.

#Crontab file for cactiuser

*/5**** /www/php/bin/php /www/htdocs/cacti/poller.php > /dev/null 2>&1


I edited the file using gedit, and it let me save and exit fine. If I use vi, I still get the bad minute error?? I'm really not sure what I am doing wrong. I can run this command from terminal fine, but obviously something is not right in crontab. I appreciate all of you all's help.

David
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Make sure to look at your syslog to see if cron is executing it. Usually /var/log/cron.log for cron syslog.
[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]
davidh
Posts: 22
Joined: Wed Oct 20, 2004 2:51 pm
Location: Laurens, SC

Post by davidh »

I don't see any evidence of it running. What is interesting (I think) is this:

Jun 2 11:29:01 fedora1 crond[3143]: (root~) ORPHAN (no passwd entry)
Jun 2 11:29:01 fedora1 crond[3143]: (cactiuser~) ORPHAN (no passwd entry)

Is the no password entry significant??

Thanks
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

/boggle

Never seen that, google that error and see what you can find? :(

On a side not, on modern linux distrubutions, typically you do not want to edit the /etc/crontab. It maybe get replaced during an update, or such. That is why I always suggest "crontab -e" which edits the user specify crontabs.
[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]
davidh
Posts: 22
Joined: Wed Oct 20, 2004 2:51 pm
Location: Laurens, SC

Post by davidh »

Rony

From what I can tell--it supposedly means that the stated user in not in my /etc/passwd file.

Obviously, root is there, also cactiuser is in my file. So I am not sure what is going on. I am going to let it rest for a bit and then post on some linux boards to see if anyone on those boards has seen this error.

I truly appreciate the patience/help shown to me on this board. I will be back.

David
pvd
Posts: 30
Joined: Sat Aug 09, 2003 3:02 pm

Post by pvd »

If you are using a recent and standard version of Linux, the best way to run the poller is the one in the manual, by editing the file

/etc/crontab

in this file add the line

*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1

in this line cactiuser tells the cron daemon to run the application as the user cactiuser.

HOWEVER

I have just discovered that for some reason - I dont really see why, cron needs to be restarted for it to read the file. so after every edit, I need to run

service crond restart

OR

/etc/rc.d/init.d/crond restart


and before everyone write to tell me this is wrong - and sends me snippets of the manpage. I know its wrong but I have done quite a lot of testing and cron is only reading the file at startup!!!!
Phil
davidh
Posts: 22
Joined: Wed Oct 20, 2004 2:51 pm
Location: Laurens, SC

YESSSS!!!!

Post by davidh »

Hey folks--I got it!!

In my crontab entry I had *5/**** I didn't have any spaces between the *'s(*5/* * * *). I added spaces and everything worked. The no spaces were causing my bad minute errors and evidently it was saving (kind of) my crontab file. This bad file was causing my ~username error in cron log.

Again, I knew it was going to be something simple, but I didn't know what. Thanks again for your help and patience with me. I have been on other boards before, and most are not as cordial and understanding with newbies.

Thanks again,

David
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

LOL!!!

I knew it was something simple!!
[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]
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests