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?  


Reply
 
LinkBack Thread Tools
  #1  
Old May 16th, 2008
bvijaycom's Avatar
bvijaycom Offline
Infrastructure Architect
 
Join Date: December 2007
Posts: 37
How to delete the diretories

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old May 16th, 2008
PaulClayton's Avatar
PaulClayton Offline
Member
 
Join Date: December 2007
Posts: 38
Re: How to delete the diretories

have you used "rm -rf"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old May 19th, 2008
john.samons's Avatar
john.samons Offline
Meditating on the code...
 
Join Date: September 2007
Location: Johannesburg, South Africa
Posts: 95
Re: How to delete the diretories

You could use the following:

ls -1 /your-path/online_* | while read onlinedir
do
echo $onlinedir #test with this first...
#rm -rif $onlinedir
done
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old May 19th, 2008
duke900ssd's Avatar
duke900ssd Offline
Senior Member
 
Join Date: March 2007
Posts: 205
Re: How to delete the diretories

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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old May 20th, 2008
ross.mather's Avatar
ross.mather Offline
Senior Member
 
Join Date: January 2007
Location: Nomadic in the UK
Posts: 407
Re: How to delete the diretories

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....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old May 20th, 2008
john.samons's Avatar
john.samons Offline
Meditating on the code...
 
Join Date: September 2007
Location: Johannesburg, South Africa
Posts: 95
Re: How to delete the diretories

I agree, test your scripts and execute them safely...


...don't drink & script... at least DON'T run them at that time.... :-)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks

These are the 100 most searched terms
Search Cloud
0042-001 0042-001 nim 0513-001 the system resource controller daemon is not active 0513-001 the system resource controller daemon is not active. 0514-061 0514-061 cannot find a child device 0514-061 cannot find a child device. 0516-787 0516-787 extendlv 0516-787 extendlv: maximum allocation for logical volume 110000ac aa00e1f3 aio aix aix aio aix freeware aixif_arp_dup_addr b150f22a b181f22a b181fb53 ba010004 c1001020 d133c002 dacnone dcb47997 fcp_array_err6 fget_config gnu tar aix gsclvmd gtar aix hi yall hmc root password hmc vmware hscl05db ibm p6 ibm p6 520 libpopt aix libpopt.a libpopt.a(libpopt.so.0) is needed by rsync-2.6.2-1 migratelv mksysb navisphere agent nim server pseries pseriestech rsync aix sc_disk_err4 scan_error_chrp vio server websm xhost file ... powered by Simple Search Cloud


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Powered by vbWiki Pro 1.3 RC5. Copyright ©2006-2007, NuHit, LLC

vBulletin Skin developed by: vBStyles.com


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50