- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- script for deleting log files in Linux
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2005 06:08 PM
тАО11-24-2005 06:08 PM
script for deleting log files in Linux
Please let me know the script with example.
Thanks
Yuva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2005 06:14 PM
тАО11-24-2005 06:14 PM
Re: script for deleting log files in Linux
find /dir_where_files_reside -type f -mtime +30 -exec rm {} \;
find /dir_where_files_reside -type d -mtime +30 -exec rm {} \;
Do not use -exec and rm first. Look at files and then delete.
find /dir_where_files_reside -type f -mtime +30 -exec ll -d {} \+
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2005 07:05 PM
тАО11-24-2005 07:05 PM
Re: script for deleting log files in Linux
find
You can create a file with that time stamp and find with -newer option in find command.
# touch [[CC]YY]MMDDhhmm[.SS] file1
Change the time + date settings based on your requirement.
# find
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2005 08:47 PM
тАО11-24-2005 08:47 PM
Re: script for deleting log files in Linux
Thanks
Yuva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-25-2005 12:28 AM
тАО11-25-2005 12:28 AM
Re: script for deleting log files in Linux
See man tmpwatch, the script is located at /etc/cron.daily/tmpwatch.
The good thing with this is that you can tell to tmpwatch to not delete files if are in use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-25-2005 09:38 AM
тАО11-25-2005 09:38 AM
Re: script for deleting log files in Linux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-07-2005 03:05 AM
тАО12-07-2005 03:05 AM
Re: script for deleting log files in Linux
thanks,
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-07-2005 04:13 AM
тАО12-07-2005 04:13 AM
Re: script for deleting log files in Linux
In the logrotate.conf file you make make specifications based on your wants.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-07-2005 04:50 AM
тАО12-07-2005 04:50 AM
Re: script for deleting log files in Linux
chkconfig logrotated on
service logroated on
Configuration files are in /etc/logrotate.d
Pretty well documented.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-08-2005 03:30 PM
тАО12-08-2005 03:30 PM
Re: script for deleting log files in Linux
I have to navigate to each directory from root and display files. Then i have to check delete the files older than 3 months. i can do it with the help of above mentioned code. But i have one more constraint. I have to keep at least 5 later versions though its older than 3 months.
can anyone help me in this regard?
Thanks in advance.