| Blogs | Classifieds | Downloads | FlashChat | Gallery | Googlemap | Invite Friends | Links | Projects | Reviews | Wiki |
| |||||||||
Welcome to the pSeries Tech Forums,
our free peer-based support site for administrators, engineers and architects working with IBM pSeries servers and software. You are currently viewing our site as a guest which gives you limited access to view most discussions, articles, tutorials and access our other free features. By joining our community you will be able to collaborate with administrators, engineers and architects charged with designing, delivering or maintaining IBM pSeries server environments. Founded by a recognized IBM pSeries consultant and IBM Redbook author, pSeries Tech Forums was developed with the single mission of bringing IBM pSeries professionals together into a single self-help community. Registration is fast, simple and absolutely free to all IT professionals with responsibility for or interest in IBM pSeries servers. We invite you to join our community today! If you have any problems with the registration process or your account login, please contact contact support. |
| Our Sponsors | |
| | |
| Want to advertise? | |
![]() |
| | LinkBack | Thread Tools |
|
#1
| ||||
| ||||
Hi, I am trying to prepare the script which should delete 2 days older directories. For files i already prepared the scripts and working fine. Here i have given the file log rotation script details which is working.. bash-3.00# more /scripts/logrotation.sh find /iims-home/data/uat1/batch/logs/batch/ -name "*.*" -mtime +1 -exec /bin/rm {} \; find /iims-home/data/dev/batch/logs/batch/ -name "*.*" -mtime +1 -exec /bin/rm {} \; find /iims-home/data/sit/batch/logs/batch/ -name "*.*" -mtime +1 -exec /bin/rm {} \; find /iims-home/data/uat2/batch/logs/batch -name "*.*" -mtime +1 -exec /bin/rm {} \; find /iims-home/data/pt/batch/logs/batch/ -name "*.*" -mtime +1 -exec /bin/rm {} \; But i dont know how delete the directory like this (if i delete the online directory,all sub-directories also should be deleted.) Here i have given my deployment directories. bash-3.00# ls -ltr total 0 drwxr-xr-x 3 iims iims 256 May 13 09:53 online_20080510142957 drwxr-xr-x 7 iims iims 256 May 16 10:24 batch drwxr-xr-x 9 iims iims 256 May 16 10:27 online_20080516112121 drwxr-xr-x 3 iims iims 256 May 16 11:04 online_20080516102749 drwxr-xr-x 9 iims iims 256 May 16 11:21 online bash-3.00# Can anybody please help me on this |
|
#3
| ||||
| ||||
You could use the following: ls -1 /your-path/online_* | while read onlinedir do echo $onlinedir #test with this first... #rm -rif $onlinedir done |
|
#4
| ||||
| ||||
Check on a test directory before you deploy your script, what happens if it ends up in the wrong directory! Imagine the nightmare scenario: script: cd some dir Message, dir not found. cd another dir/another dir / etc / etc. Message, dir not found. rm -R * deleting -R / root filesystem successfully dele......crash, no more system! |
|
#5
| ||||
| ||||
personally, for the rason duke900ssd lists I am opposed to using rm -r type commands in any cron jobs. Delete the files in the reqired directory explicitly and then rmdir the directory. Its more work - but a lot safer. Test the script using mv to an alternate location for a few weeks first.
__________________ Ross Mather, IBM AIX IT Specialist. That said anything I say here is my own opinion and not anything that you can ever hold against IBM. Ohhh and don't forget that I make mistakes too.... |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |