Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Script, need file-delete, the oldest, after the 5 Log entry

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
mauric
Posts: 43
Joined: 2017-07-25 08:50

Script, need file-delete, the oldest, after the 5 Log entry

#1 Post by mauric »

Hello glass sphere

Please i need any little script to delete the oldest after the 5 Version, of this Output from this log file creator.

FILE="lalala_$(date +%b)_$(date +%d)_$(date +%Y)_$(date +%S)sec."
/bin/cat /var/filename >/var/filename/$FILE

with Find i have try but there are to dangerous... she will delete all that older than 5 day.

thanks

User avatar
sunrat
Administrator
Administrator
Posts: 6476
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 118 times
Been thanked: 474 times

Re: Script, need file-delete, the oldest, after the 5 Log en

#2 Post by sunrat »

There's a default program that does that:

Code: Select all

man logrotate
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

Post Reply