Linux / UNIX Tech Support Forum
This is a discussion on shell script to zip old files and then delete within the Shell scripting forums, part of the Development/Scripting category; Hi All, Good day, we have few RHEL 3/4 servers and whose disk space always be 100% (/opt) and we ...
|
Register free or login to your existing account and remove all advertisements. |
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi All,
Good day, we have few RHEL 3/4 servers and whose disk space always be 100% (/opt) and we need to manually delete some logs to free up space. we now decided to write up some shell script to automate the works. The requirement was given by my lead to start the work. I am not good at shell script so though of asking you guys for help. here is the requirement, /opt/jboss-4.2.1/server/bos/log/BOS-APP-SERV1_bos-server.log.2009-02-20-16 Example (using sym link) would be: Source path: /opt/jboss/server/bos/log Source template : [hostname]_bos-server.log.* 1) Check hourly for files in <destination-path><destination-file-template><destination-file-suffix> for files older than <destination-file-retention> days and purge. It should then check <source-path><source-file-template> for files older than <source-file-retention> and compress them based on <tar-flag> or <gzip-flag> or both. The compressed files should be in <destination-path><destination-file-template><destination-file-suffix>. 2) Provide variable parameters for the following, clearly commented, at the top of the script Source-path # Source location for files matching source file template Source-file-template # File name template Source-file-retention # Files older than (hours) will be processed Destination-path # Destination may be same or different than the Source path Destination-file-suffix # None or specified) Destination-file-template # Could equal source file template or be a combination of source plus suffix Destination file retention (days) # Files older than this are deleted (usally 3 days old) Tar flag # If true or y then use tar Gzip flag # If true or y then use gzip (may both be set for tar and gzip) Please help us on this. Thanks |
| Sponsored Links | ||
|
|
|
|||
|
Question is: do you want to be? I mean, you're good at copying requirements verbatim (do services in general like it to get their logs rotated from under them w/o some form of -HUP?) but you haven't shown any (pseudo) code one could help you improve?..
|
|
|||
|
Question is: do you want to be?
no, i will try to write a script myself and update it here if required any help. I think this is the way it works. Thanks |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script to delete a set of files in Remote machine | ashok333 | Shell scripting | 4 | 05-09-2008 07:24 PM |
| Shell Script to Automatically Delete a File via Cron Job | kakarla | Shell scripting | 2 | 01-29-2008 08:54 AM |
| i need a script to delete one folder with files on my ftp | silver_ch | Shell scripting | 1 | 03-27-2007 10:15 AM |
| Shell script to delete a file with a dialog utility | shankar100 | Shell scripting | 4 | 03-02-2007 10:22 AM |
| Shell script for automatic conversion of files in tar files | kasimani | Shell scripting | 2 | 02-08-2007 03:45 PM |