Novell Cool Solutions: Trench
By Brian Nagozruk
Digg This -
Posted: 16 Aug 2005
PROBLEM: Are you running red-carpet? Have you had a download fail, and ended up with a corrupt red-carpet package that cannot be updated? Now you have to hunt it down manually and remove it.
SOLUTION: I wrote this script to assist in removing cached files that may have been corrupted due to local network or Internet-related communication issues.
It will locate any files saved in the rcd packages directory (i.e. located in /var/cache/rcd/packages/) that contain .rpm in the file name, but do not end in 'rpm'.
EXAMPLE: You are downloading an update to package-x when your DSL line drops. You now have a partially cached package. You attempt to restart the download and it fails because of that partially cached rpm package. Rather then typing commands to change your working directory and finding then removing files manually, you simply launch this script and it takes care of it for you.
During the execution of the script it would produce results similar to this...# rcd-cleanup
removing file /var/cache/rcd/packages/package-x-13.3.53-0.2.i586.rpm.TMQs834
Place in path, chmod it, check access perms on script. If you changed the location of rcd/packages adjust the script, otherwise enjoy.
#!/bin/bash # # rcd-cleanup # # USE THIS CODE AT YOUR OWN RISK. BEFORE RUNNING THIRD PARTY SCRIPTS # ON ANY SERVER YOU OWN/MANAGE, YOU SHOULD ALWAYS (ATTEMPT TO) UNDERSTAND # WHAT THE SCRIPT OR APPLICATION DOES PRIOR TO DEPLOYMENT. # HINT: LAB. # # cd /var/cache/rcd/packages for file in \.rpm\.*; do if [ -f $file ] then echo removing file $file rm -f $file fi done
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com