- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- HOusekeeping files
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
Forums
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
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
тАО10-09-2001 03:07 AM
тАО10-09-2001 03:07 AM
HOusekeeping files
I am rajkumar..Do any one have an idea about the Housekeeping files..
I have the environment like this..
Suppose i created a directory called /test.In that directory every day or for every week one file or some "n" files will be generated through another application..
So i have to delete that file using CRONTAB..And if any error occurs while deleting the file it has to be written to some logfile or it has to be promted to user about the status of the file..
Note: The file name is not constant..because the file will be generated with different name..It should be Parameterized..
The file name will be like
this : FILE<11111>.
Can any one help me by proving the Script ???
Thanks for the Advance in Help..
Regards
Rajkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-09-2001 03:15 AM
тАО10-09-2001 03:15 AM
Re: HOusekeeping files
find /test -atime +3 -type f -print -exec rm -f {} \; > /tmp/rm.log 2&>1
This will delete any file that was access more that 3 days ago and will log the file name and any errors to /tmp/rm.log
-Santosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-09-2001 03:15 AM
тАО10-09-2001 03:15 AM
Re: HOusekeeping files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-09-2001 03:17 AM
тАО10-09-2001 03:17 AM
Re: HOusekeeping files
Using 'cron' to clean up filesystems is
quite normal. Usually it is either /tmp
or /var/tmp that have most of the
temporary files that need to be deleted,
but of course this depends on the application.
A simple thing could be from 'cron'
0 5 * * * find /tmp -name -mtime +7 | xargs rm
which will delete all files in /tmp that haven't been modified in 7 days. Changing the names of the files can be also done quite simply by using wildcards
HTH
-Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-09-2001 05:30 AM
тАО10-09-2001 05:30 AM
Re: HOusekeeping files
You could do something simple like this, If you want to run this as a user, make sure you allow that user to run cronjobs by modifying /var/adm/cron/cron.allow
/Begin/
#!/usr/bin/sh
PATH=/usr/bin:/usr/contrib/bin:/usr/local/bin
DIR=/test
LOG_FILE=/tmp/delete_log
USER=testuser
# Listing the files that will be deleted
echo "These files will be deleted" > $LOG_FILE
find $DIR -atime +3 -exec ll {} \; >> $LOG_FILE
# Deleting the files that haven't been accessed for 3 days.
# Look at the man page of find for more options.
find $DIR -atime +3 -exec rm {} \; >> $LOG_FILE 2>&1
#Mailing the results to the user
mailx -s "Logfile Deletion" $USER < $LOG_FILE
#Cleaning up
rm $LOG_FILE
/End/
This should get you started.
-Regards
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2001 01:35 AM
тАО10-10-2001 01:35 AM
Re: HOusekeeping files
I have another query similar to this..
Suppose i have the Two servers one is "PRODUCT" server & "INVENTORY" server.
Daily the product server will FTP some files from the "INVENTORY" Server.
Once the file (test0000.dat) was transfered from the Inventory server to product server the file name was renamed to "X_TEST0000.DAT".
I created an Oracle Table called "PROFILE"
In that table i have 3 columns like
a) card_id
b) In_dir
c) Our_dir
Card_id:
-----------
In this column maximum 9 card_ids will be stored..For each 9 Card_ids the 9 directory paths will be stored in In_dir & Out_dir.
In_dir:
--------
In this column only the Inputfile name will be stored followed by the directory path..
For Eg: /test1/test0000.dat (to) /test1/test9999.dat
Out_dir:
--------
In this column only the Outputfile name will be stored followed by the directory path..
For Eg: /test1/test0000.dat (to) /test1/test9999.dat
So what i have to do is i have to write a shell script which runs automatically using Cronjob.
The shell script has to read the Two columns "In_dir" & "Out_dir" (ie Inputfile & Output File) from the oracle table and get the path for 9 Card_ids and check the file name start with "X_test0000.dat" to "X_test9999" in those directories and it has to be deleted for every 3 days only..If it found any file older than 3 days it has to be deleted for every 30 days...
Thanks for the Advance in Help
Regards
Rajkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2001 03:01 AM
тАО10-10-2001 03:01 AM
Re: HOusekeeping files
Post your last question as a new question and do not forget to asign points to those who have helped you.
;-)
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2001 07:17 PM
тАО10-10-2001 07:17 PM
Re: HOusekeeping files
I am very sorry about that..because i am little bit hurry to complete the assingned tasks to me...Appolizise....It will not repeat it again..
Ok Can any one help about ..Regarding the previous message My script has to collect the directory names from the two columns and that files has to be deleted for every 3 days starting with the name "X_"
Thanks for the advance in Help..
Rajkumar