Logwatch query about Cron : ERROR (getpwnam() failed

Issues related to applications and software problems
aegersz
Posts: 66
Joined: 2016/04/04 07:42:58

Logwatch query about Cron : ERROR (getpwnam() failed

Postby aegersz » 2017/06/17 11:35:16

since i moved to 6.9, I am seeing this in logwatch:

Code: Select all

--------------------- Cron Begin ------------------------

 
 **Unmatched Entries**
 ERROR (getpwnam() failed)
 
 ---------------------- Cron End -------------------------


any idea what it is telling me ?

User avatar
TrevorH
Forum Moderator
Posts: 20600
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Logwatch query about Cron : ERROR (getpwnam() failed

Postby TrevorH » 2017/06/17 11:55:14

Probably telling you there are errors in /var/log/cron

man getpwnam says "The getpwnam() function returns a pointer to a structure containing the broken-out fields of the record in the password database (e.g., the local password file /etc/passwd, NIS, and LDAP) that matches the username name." so I'd say it's possible you have a cron job set up for a user that's been removed or something like that.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

aegersz
Posts: 66
Joined: 2016/04/04 07:42:58

Re: Logwatch query about Cron : ERROR (getpwnam() failed

Postby aegersz » 2017/06/17 12:09:03

Yes, you are probably right as the cron log showed this error (i missed it the first time i scanned the log):

Code: Select all

Jun 16 02:00:01 forum crond[1827]: (/usr/bin/perl) ERROR (getpwnam() failed)


and it was the only entry in my crontab WITHOUT a user associated with it so i added "root":

Code: Select all

00 02 * * * root /usr/bin/perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=XXXX -update


Thanks again, you put me on the right track !

User avatar
TrevorH
Forum Moderator
Posts: 20600
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Logwatch query about Cron : ERROR (getpwnam() failed

Postby TrevorH » 2017/06/17 12:41:04

Odd. The awstats package from EPEL puts its cron entry in /etc/cron.hourly which doesn't need a username.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

aegersz
Posts: 66
Joined: 2016/04/04 07:42:58

Re: Logwatch query about Cron : ERROR (getpwnam() failed

Postby aegersz » 2017/06/17 13:09:04

I am using /etc/crontab - would that matter ?

the /var/log/cron shows that it's ok now so i'm happy.

EDIT: I know what i have done wrong - the entry in /etc/crontab does not need to be there as it is running hourly anyway !