Sponsored Content
Full Discussion: Logfile rotation script.
Top Forums Shell Programming and Scripting Logfile rotation script. Post 302346887 by HardyV2 on Monday 24th of August 2009 10:29:39 AM
Old 08-24-2009
Cool thxz for that!

I was just fumbling around and am testing this code out now and seems to be working for what I need. Thxz anyways for your help will save it; since other ways are always helpful too, thxz.

Code:
#!/usr/bin/perl 
 
use strict; 
use warnings; 
 
use File::Copy; 
for my $i ( 3, 2, 1 ){ 
  if( -e "notes.$i" ){ 
    my $j = $i + 1; 
    move( "notes.$i", "notes.$j" ) or die "Could not move notes.$i to notes.$j: $!\n"; 
  } 
} 
if( -e "notes" ){ 
  move( "notes", "notes.1" ) or die "Could not move notes to notes.1 $!\n"; 
}

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Log Rotation Tool/Script

Hello all Does anyone has an intersting script or a good freeware tool for log rotation that is good for Unix and Linux as well ? My thanks in advance (4 Replies)
Discussion started by: yelalouf
4 Replies

2. Shell Programming and Scripting

Log rotation script

I have the below script to help with disk space cleanup that finds logs older than a specified number of days (say 10 days). I need it to grab "active" logs as well. Problem is an "active log" will not get archived unless I put in 0 days which I don't want to do, I need to leave the past 10 days,... (2 Replies)
Discussion started by: theninja
2 Replies

3. Shell Programming and Scripting

Attaching a logfile to the Script

Hello guys. I've recently written a basic utilities script just for home use. and i want to attach a logfile to it that will record all the commands that where executed in that script. Then just so i can add the d%b%y% and make each logfile unique and i can look back in each logfile to see what i... (9 Replies)
Discussion started by: matt02
9 Replies

4. Shell Programming and Scripting

Logfile monitor script

Hi, I'm trying to write a logfile monitor script that reads the logfile and then emails out once there is an error with SQL in. Here is my attempt below which does not work. I'm not much of a scripter as you can probably see but some pointers in the right direction would be much appreciated. ... (3 Replies)
Discussion started by: elmesy
3 Replies

5. Shell Programming and Scripting

Log rotation issue with script

I have application which to the heavy stdout and I have diverted the stdout to log file. this log file is writing very heavily and we have a script which rotates the logs. logic for rotation is smthing like cp logfile logfile.1 cat /dev/null > logfile this logic was working fine till we... (3 Replies)
Discussion started by: navinmistry
3 Replies

6. Shell Programming and Scripting

Script to monitor errors in logfile

Hi, I would like to implements monitoring tool which looks at the logfile and sends me an email with error messages from the logfile. The runtime errors are printed in logfile. The logfile also contains some warning and debugging messages. For errors, the line will start with “Error”., the error... (1 Reply)
Discussion started by: LinuxLearner
1 Replies

7. Shell Programming and Scripting

Script for Logfile Inserting into the Database

Here's the problem. I have a shell script running for every one minute as cronjob that outputs to a log file. I want to be able to take the data from the log file and insert it into a mysql database. The script needs to run at a set period of time and remove the log file data once the insert is... (7 Replies)
Discussion started by: kgrvamsi
7 Replies

8. Shell Programming and Scripting

generate logfile in a shell script

Unix Gurus, I have a shell script which has few "echo" statements. I am trying to create a logfile where all the outputs of the echo statement sare stored. I will have to add this as the final step in the existing script so that everytime the script runs, a logfile is generated with all the... (1 Reply)
Discussion started by: shankar1dada
1 Replies

9. Shell Programming and Scripting

Log rotation script

I have an application that rotate its log once it reaches 100mb and it keeps a total of 24 logs. I am trying to write a script to run daily to tar up the previous day logs files and move them to a different directory. here is a long listing of the logs in the directory: -rw-r--r-- 1 user1 ... (6 Replies)
Discussion started by: e_mikey_2000
6 Replies

10. Shell Programming and Scripting

Logfile monitoring with logfile replacement

Bonjour, I've wrote a script to monitor a logfile in realtime. It is working almost perfeclty except for two things. The script use the following technique : tail -fn0 $logfile | \ while read line ; do ... some stuff done First one, I'd like a way to end the monitoring script if a... (3 Replies)
Discussion started by: Warluck
3 Replies
NFPRINT(1)						      General Commands Manual							NFPRINT(1)

NAME
nfprint - Print the contents of a notesfile SYNOPSIS
nfprint [ -p ] [ -l# ] [ -d or -nd ] [ -c ] [ -t ] topic [ note-list ] DESCRIPTION
Nfprint gives the user the ability to print the contents of notesfiles. Nfprint writes to standard output. The text is formatted with pr(1). When the -c option is used, the output is filtered through cat(1) instead. The -l# parameter specifies the page length to use (66 lines/page is the default). By specifying -p, the printout is arranged so each base note starts on a new page. The -d and -nd options specify only notes with the director flag on or off respectively are to be printed. Use -t to generate a list of titles only; the text of notes and responses is suppressed. The note list is the set of notes which are to be printed. An example note list is: 1,30-36,13,10,42-50. FILES
/bin/pr Output filter /etc/passwd for the users name /etc/group for the users group(s) /usr/spool/notes the default notesfile data base SEE ALSO
notes(1), pr(1), The Notesfile Reference Manual AUTHORS
Ray Essick (uiucdcs!essick, essick%uiuc@csnet-relay.arpa) Department of Computer Science University of Illinois at Urbana-Champaign Urbana, IL Rob Kolstad (kolstad@convex.UUCP) CONVEX Computer Corporation Richardson, TX University of Illinois NFPRINT(1)
All times are GMT -4. The time now is 12:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy