[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: yum clean bug



On Thu, December 8, 2005 7:19 pm, Konstantin Ryabitsev said:

> cd /var/cache/yum
> for DIR in *; do
>     if ! grep -q "[$DIR]" /etc/yum.repos.d/*.repo; then
>         rm -rf $DIR
>     fi
> done
>
> There you go. You can put it in your cron.weekly.


This script is a bit fragile.  There will be bad consequences if
/var/cache/yum goes missing for whatever reason; it's likely to wipe out
your entire filesystem.   Better to fail rather than proceed if the "cd"
fails.   Even with that fixed the script could do unintended things if any
of the directories happen to have a space in them because $DIR isn't
properly quoted.

Sean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]