Hi Beth. Not sure how it is on the S/390 (nice box, BTW), but any usual logrotate script I've come across would send a SIGHUP to the appropriate process, yes. Check the cron jobs of the root user, and there should be a cron job for this. Then you could run another cron job to do the processing after it has been rotated, to do whatever processing you'd need....
Here's an example of such a script, snipped from a SOLARIS box.. Should be able to adapt this to your needs.. ;) #!/bin/sh LOG=messages cd /var/adm test -f $LOG.2 && mv $LOG.2 $LOG.3 test -f $LOG.1 && mv $LOG.1 $LOG.2 test -f $LOG.0 && mv $LOG.0 $LOG.1 mv $LOG $LOG.0 cp /dev/null $LOG chmod 644 $LOG # LOGDIR=/var/log LOG=syslog if test -d $LOGDIR then cd $LOGDIR if test -s $LOG then test -f $LOG.6 && mv $LOG.6 $LOG.7 test -f $LOG.5 && mv $LOG.5 $LOG.6 test -f $LOG.4 && mv $LOG.4 $LOG.5 test -f $LOG.3 && mv $LOG.3 $LOG.4 test -f $LOG.2 && mv $LOG.2 $LOG.3 test -f $LOG.1 && mv $LOG.1 $LOG.2 test -f $LOG.0 && mv $LOG.0 $LOG.1 mv $LOG $LOG.0 cp /dev/null $LOG chmod 644 $LOG sleep 40 fi fi # kill -HUP `cat /etc/syslog.pid` You can just reiterate this, and change the $LOG and pid file to whatever you want. This should be easy enough to change to something dynamic, if you wish as well.... Enjoy! Best Regards Anders Holm Critical Path Technical Support Engineer ---------------------------------------------------------------------- Tel USA/Canada: 1 800 353 8437 Tel Worldwide: +1 801 736 0806 E-mail: [EMAIL PROTECTED] Internet: http://support.cp.net > -----Original Message----- > From: Rice, Elizabeth A. [mailto:[EMAIL PROTECTED]] > Sent: 01 July 2002 12:51 > To: '[EMAIL PROTECTED]' > Subject: RE: updating a file in place is almost working > > > 1) The platform is UNIX Systems Services on OS/390. > 2) I'm one of the Systems Programmers. > 3) We might be able to send a sighup to the process, but we can't mod it. > There are no other log backup processes in place. I've heard about the > logrotate script, but there was some other processing we wanted to do with > the file also. Does the logrotate script send a sighup to the process? > > Thanks again, > Beth Rice > > > > ---------- > > From: Anders Holm[SMTP:[EMAIL PROTECTED]] > > Sent: Monday, July 01, 2002 5:19 AM > > To: [EMAIL PROTECTED]; Rice, Elizabeth A.; > > [EMAIL PROTECTED] > > Subject: RE: updating a file in place is almost working > > > > Hi. > > > > 1/ What platform are you on? > > 2/ Are you the System Administrator? > > > > 3/ There is on Solaris and Linux usually a script that would do log > > rotation. There would not be a need to take down the process, but rather > > do > > the following (assuming you have the rights): > > > > mv <logfile> <logfile.n> > > > > n = number 0-9. If file <logfile.0> already exists, that should > be rotated > > to <logfile.1> and so on. <logfile.9> is usually "dropped"... > > > > After the file has been moved send a SIGHUP to the PID of the > appropriate > > process, and you are done. This ensure that the process starts > writing to > > <logfile> again. If no SIGHUP is sent, the process will > continue to write > > to > > the old log file, which is now <logfile.0>... For a further > explanation on > > this, read up on inodes and how they work.. ;) > > > > If you already have a log rotation scheme in place, utilize that as > > opposed > > to inventing the wheel again. ;) > > > > Hope this clears up any questions. > > > > Best Regards > > > > Anders Holm > > Critical Path Technical Support Engineer > > ---------------------------------------------------------------------- > > Tel USA/Canada: 1 800 353 8437 > > Tel Worldwide: +1 801 736 0806 > > E-mail: [EMAIL PROTECTED] > > Internet: http://support.cp.net > > > > > > > -----Original Message----- > > > From: [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED]] > > > Sent: 28 June 2002 22:04 > > > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > > > Subject: RE: updating a file in place is almost working > > > > > > > > > I think you will have a problem unless somehow you can tell the > > > service that you want to update the file. As long as the process has > > that > > > file open, it will not change where it is writing to regardless > > > of renaming > > > and moving. > > > > > > The process that is generating the logfile: is it one you can make > > > mods to or not? If make mods, then have it take care of the > > > logfile on daily > > > basis itself. If not, then you wouldneed to stop and restart the > > process. > > > There might a Unix guru on the list who can tell you otherwise. > > > > > > Wags ;) > > > > > > -----Original Message----- > > > From: Rice, Elizabeth A. [mailto:[EMAIL PROTECTED]] > > > Sent: Friday, June 28, 2002 11:23 > > > To: '[EMAIL PROTECTED]' > > > Subject: updating a file in place is almost working > > > > > > > > > We have a log file that gets really huge, so I wanted to to edit > > > it in place > > > to delete old entries and only leave today's entries in the > current log. > > > The process writing to the log doesn't come down for months at a time. > > > Old entries should get written to an archive file. > > > The whole thing should get backed up. > > > The existing log should only have today's entries in it after the > > > process is > > > complete. > > > > > > Here's what I have coded so far.... > > > > > > > > > > > > > > > $logcopy="${logdir}/${logfile}.archive"; > > > > > > > > > > > > open (LOGCOPY, ">${logcopy}") or die ("Cannot open $logcopy \n"); > > > > > > @ARGV = ("${logdir}/${logfile}"); # prime the diamond operator > > > > > > $^I = ".bak"; # write $logfile.bak for backup > > > > > > while (<>) { > > > > > > #print $_; > > > > > > #print "todayfound is $todayfound \n"; > > > > > > if ($todayfound eq "y") { # if today's date has > already been > > > found > > > print; # write to ARGVOUT, the > new logfile > > > > > > } elsif (m/($weekday)\s+ # match for today's weekday, spa > > > > > > ($month)\s+ # and today's > month, spaces > > > > > > (\d+)/x # and one or more digits > > > > > > and $3 == $day){ # and digits are day of > > month > > > > > > $todayfound="y"; # then set flag for date > > found > > > > > > print; # write to ARGVOUT, the new > > logfile > > > > > > } else { # if we have not reached > > > today's date > > > > > > print LOGCOPY; # write the line to the logcopy > > file > > > > > > s#.*\n##; # erase the line > > > > > > } > > > > > > } > > > > > > close (LOGCOPY); > > > > > > > > > > > > It performs somewhat as expected. > > > > > > All entries are still in the .bak file. > > > Entries prior to today's date go to LOGCOPY, the archive file. > > > Only today's entries go to $logdir/$logfile, the original file name. > > > > > > The problem is that the open process is now writing to the .bak > > > file instead > > > of the filename it's defined to go to. If I simply do a move I've got > > all > > > the entries back in the log file again. > > > > > > Obviously I'm doing something wrong. Help? > > > > > > Note: Entries in the log are mutli-line. The format is > along the lines > > > of.... > > > > > > [Fri Jun 28 13:17:18 2002] > /IS/Listener/0/Informational/0/Build-PQ57139 > > > Initialization completed, 'Listener' service is online. > > > > > > Also, it shouldn't matter, but this is a script under UNIX > > > Systems Services > > > on the mainframe. > > > > > > Thanks, > > > Beth > > > > > > > > > > > > > > > -- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > -- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]