LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-20-2015, 11:12 AM   #1
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Logrotate sometimes issuing error message


I'm getting emails from cron when it runs logrotate for an apache instance:
Code:
httpd: no process killed
error running postrotate script
The postrotate script is currently:
Code:
/bin/kill -HUP `pgrep -u root httpd`
The postrotate script was changed to that on the theory that there may be errors from sending SIGHUP to the Apache child processes. We just wanted to signal the parent. Before the change the script was:
Code:
/usr/bin/killall -HUP httpd
Changing the script hasn't affected the messages I'm seeing in the emails.

One other twist: despite having a 'sharedscripts' directive in the logrotate config file, I'm seeing those two error messages multiple times in my emails. This leads me to think that the postrotate script is running for every file being rotated.

When I run the 'logrotate -vf' by hand for apache, I get no errors. And no squawking about processes not being killed.

Any ideas?

I saw one discussion that mentioned that this could arise from have /tmp mounted 'noexec'. It isn't so that shouldn't be causing the messages I'm seeing.

TIA...
 
Old 05-21-2015, 05:50 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Use "sharedscripts" in your rotate config file to control whether or not the script will run for each file versus after all files are dealt with. That shows in the logrotate man page if you wish more information.

It would seem to me that this is a permissions thing given all the other diagnosis you've performed.

Maybe also put in a fully qualified pathname for the pgrep command.
 
Old 05-21-2015, 09:24 AM   #3
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Original Poster
Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by rtmistler View Post
Use "sharedscripts" in your rotate config file to control whether or not the script will run for each file versus after all files are dealt with. That shows in the logrotate man page if you wish more information.
Sorry I didn't post the entire logrotate configuration. 'sharedscripts' is actually in there which is what makes some of what I'm seeing so puzzling.

Quote:
It would seem to me that this is a permissions thing given all the other diagnosis you've performed.
Not sure how permissions would come into play but I can double check. Log files are getting rotated so the permissions are not totally wrong.

Quote:
Maybe also put in a fully qualified pathname for the pgrep command.
I was entering that command from memory (not being on the actual system when I posted). Both commands have complete paths.

Someone at work mentioned in passing that this could be something 'screwy' in the 'state' file. I'm checking into that. Of course, if I find something in there, the next question will be "well what the heck caused that".

I'm also setting up a cron entry outside the normal cron.daily execution to see if I can reproduce what's happening during the cron.daily execution. As I mentioned, running logrotate 'by hand' at the command line does not generate these messages. Sometimes that's because of personal environment settings that aren't seen in the cron run but we all keep our login profiles extremely simple to avoid those situations. (I limit the changes to aliases only, keep those in a separate file, and only source that file at login if it's seen so renaming it gives me the 'default barebones' environment.) First test: run 'set' in cron to compare the results of that command issued at the command line. Could be our standard barebones profile has something in there that's thwarting my testing.

Thanks for the suggestions. I'll post what I see from my tests.

Later...
 
Old 05-21-2015, 09:30 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
OK well as in all cases, you can add a ton more debug. You can echo stuff out to a log every time the script runs and verify if it runs "per file" or not. You can also echo out the result code of the command and a variety of other stuff, and put that all into a log file. I'd put in a ton of stuff just to ensure that what I thought was happening is really happening, and so forth.
 
Old 05-21-2015, 10:13 AM   #5
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Original Poster
Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by rtmistler View Post
OK well as in all cases, you can add a ton more debug. You can echo stuff out to a log every time the script runs and verify if it runs "per file" or not. You can also echo out the result code of the command and a variety of other stuff, and put that all into a log file. I'd put in a ton of stuff just to ensure that what I thought was happening is really happening, and so forth.
I've added "echo $?" statements to the postrotate script and only got a single "0" from the 'kill' command but that was during command line testing where the multiple error messages are not being produced.

Quick question:

Is there any difference between using:
Code:
sharedscript
postrotate
   stuff to do
endscript
and
Code:
lastaction
   stuff to do
endscript
I suspect there's a subtle difference but want to float the question and get another's opinion/experience/etc.

One thing I just noticed in the logrotate manpage: The list of the directives lists "sharedscripts" but the description refers to it as "sharedscript". I noticed that the author of the config file decided to use the plural version. It could well be that the directive is being ignored because it's spelled wrong. (Uh... shouldn't logrotate complain about that?) (Edit: 'sharedscripts is, indeed, the correct spelling despite the confusing mention of 'sharedscript' in the manpage's description. And logrotate does complain when it sees a directive that it doesn't understand.)

By the way.... I didn't see anything terribly unusual in that system's logrotate 'state' file though I admit I've never looked at one before. Names of file and rotate dates. Nothing looked weird.

Back to my testing...

Last edited by rnturn; 05-21-2015 at 02:23 PM. Reason: Clarification
 
Old 05-21-2015, 02:34 PM   #6
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by rnturn View Post
One thing I just noticed in the logrotate manpage: The list of the directives lists "sharedscripts" but the description refers to it as "sharedscript". I noticed that the author of the config file decided to use the plural version. It could well be that the directive is being ignored because it's spelled wrong. (Uh... shouldn't logrotate complain about that?) (Edit: 'sharedscripts is, indeed, the correct spelling despite the confusing mention of 'sharedscript' in the manpage's description. And logrotate does complain when it sees a directive that it doesn't understand.)
sharedscripts

Plural. I have a copy of the source and the code is performing a strcmp() against the string "sharedscripts"

The lastaction directive may be what you want if you're using a wildcard, but also realize that the man pages says "if and only if at least one log is rotated" so the action won't occur if nothing is rotated. And again, this applies when you have a wildcard qualifier to determine what log files the action is to be applied for.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Server Hung with error message: ERROR: Message hist queue is filling up iprince Linux - Enterprise 7 02-10-2014 09:40 AM
[SOLVED] error when issuing mkdir command unix1adm Linux - General 2 09-09-2010 01:50 AM
error message when issuing sudo halt utanja Debian 8 03-18-2008 11:30 AM
Error while issuing "make htmldocs" in Documentation/DocBook dir of Kernel source samkraju Linux - General 6 09-07-2007 12:55 PM
Cron.daily sends me a logrotate Kill usage message. pollardd Linux - General 1 09-02-2005 12:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration