Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Perl script log sync issue



At 3:19 AM -0400 10/29/04, webmaster wrote:
I've got a perl script running (amavisd) which I'm trying to rotate the log file, problem is, it quits perl and leaves the process not running.

Here's the code.


#!/bin/sh -
#
echo -n "Rotating log files:"
cd /var/log/clamav
for i in clamd.log freshclam.log amavis.log; do
if [ -f "${i}" ]; then
echo -n " ${i}"
if [ -f "${i}" ]; then mv -f "${i}" "${i}.0" && if [ -x /usr/bin/gzip ]; then gzip -9 "${i}.0"; fi; fi
touch "${i}" && chmod 644 "${i}" && chown clamav:admin "${i}"
fi
done
if [ -f /var/amavis/amavisd.pid ]; then kill -HUP $(cat /var/amavis/amavisd.pid | head -1); fi;
if [ -f /var/clamav/clamd.pid ]; then kill -HUP $(cat /var/clamav/clamd.pid | head -1); fi
if [ -f /var/clamav/freshclam.pid ]; then kill -HUP $(cat /var/clamav/freshclam.pid | head -1); fi



clamd and freshclam seem to resync the log files but amavisd doesn't.

Anyone have a solution?

Offhand I'd say you need to move files, then HUP their loggers, then zip the moved files. gzip, iirc, may attempt to delete the file resulting in the process losing the handle and resulting strangeness. It's a VERY bad practice to delele files to which things are writing.
--


-dhan

------------------------------------------------------------------------
Dan Shoop                                              email@hidden
Consulting Internet Architect                              email@hidden
AIM: iWiring                                     http://www.iwiring.net/
Skype: danshoop                                   http://www.ustsvs.com/

If your reason for voting for one political candidate is that they are not the other guy, that's not a reason to vote for either. As politically bias as Tucker Carlson is he does have it right, "If you don't have a clear reason for preferring a candidate, please *DO NOT* vote."
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macos-x-server mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/macos-x-server/email@hidden


This email sent to email@hidden
References: 
 >Perl script log sync issue (From: webmaster <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.