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

[cobalt-developers] /usr/bin/whack-cache



I noticed that the web interface for 'Empty Cache' on our Cobalt CacheRaQ2 didn't work correctly so I examined /usr/bin/whack-cache. So, here follows a brief explanation of what I did to make it work.

[...]

if [ -f /home/squid2/cache ] ; then
     ^^^
        mv /home/squid2/cache /home/squid2/00cache

        mkdir /home/squid2/cache
[...]

Shouldn't this be 'if [ -d /home/squid2/cache ]; then' and so on? It's supposed to be a directory, not a file as the if statement checks for.

Later when the script tries to remove /home/squid2/00cache it runs 'rm -f' instead of 'rm -rf'. Yet again, it treats /home/squid2/{00}cache as if it were a file.

So a 'diff whack-cache whack-cache.orig' gives an output of:

[root@cache2 bin]# diff whack-cache whack-cache.orig
12c12
< if [ -d /home/squid/cache ] ; then
---
> if [ -f /home/squid/cache ] ; then
22c22
< if [ -d /home/squid2/cache ] ; then
---
> if [ -f /home/squid2/cache ] ; then
30c30
<       rm -rf /home/squid2/00cache < /dev/null >& /dev/null &
---
>       rm -f /home/squid2/00cache < /dev/null >& /dev/null &

Hmm, I don't know if this is a known problem / or even possibly me beeing wrong? Looked through the KB without any results.

--

Thomas Novin · thnov@xxxxxxxxxxx · http://www.algonet.se/~tnovin/
Thalamus Networks AB · +46 (0)431 445400 · http://www.thalamus.se
Fingerprint: 24CF 3C93 680B ADFC FD3B  BB21 300C 1D8C E854 E02E