943,621 Members | Top Members by Rank

Ad:
  • Perl Discussion Thread
  • Unsolved
  • Views: 783
  • Perl RSS
Aug 23rd, 2009
-1

Logfile rotation sciprt using perl.

Expand Post »
I'm trying to find or create a Perl script that:
Checks for and creates these files:

notes
notes.1
notes.2
notes.3
notes.4

The first represents the current log file and the others are older versions. Each time the script runs it would check for the existence of notes.3 and, if it exists, move it to notes.4. Then is should check for notes.2 and move it to notes.3 and so on, until notes is moved to notes.1.

I've looked on the net already, but they're just too complex and try to do too much compared to my requirements.

Does anyone know of a script that does this, or do you have any code that could be adapted easily?

Thanks!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
DemonixXV2 is offline Offline
9 posts
since Aug 2009
Aug 23rd, 2009
0

Re: Logfile rotation sciprt using perl.

You should just append a date to the end of the log file then you don't need to rename all the other files every time the script runs.
Reputation Points: 246
Solved Threads: 67
Practically a Posting Shark
KevinADC is offline Offline
898 posts
since Mar 2006
Aug 24th, 2009
0

Re: Logfile rotation sciprt using perl.

Yeah, but I need a script, since I'll be needing it multiple times with different files. Since I'll be creating a library file with the code.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
DemonixXV2 is offline Offline
9 posts
since Aug 2009
Aug 24th, 2009
0

Re: Logfile rotation sciprt using perl.

You already got a script on another forum so I will drop out of this thread
Reputation Points: 246
Solved Threads: 67
Practically a Posting Shark
KevinADC is offline Offline
898 posts
since Mar 2006
Aug 24th, 2009
0

Re: Logfile rotation sciprt using perl.

Yep I managed to get one working , thxz for your effort anyways; thxz.
Last edited by DemonixXV2; Aug 24th, 2009 at 3:13 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
DemonixXV2 is offline Offline
9 posts
since Aug 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Perl Forum Timeline: the use of $_ in substitution
Next Thread in Perl Forum Timeline: substitution regex question





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC