Code: Select all
#!/bin/sh
BASENAME=`basename "$1"`
LOGFILE="$1/clamscan.log"
/usr/bin/clamscan -i -l "$LOGFILE" -r "$1"
if [ $? -eq 1 ]; then
cd "$1"/..
mv "$BASENAME" _INFECTED_"$BASENAME"
fi
Code: Select all
#!/bin/sh
BASENAME=`basename "$1"`
LOGFILE="$1/clamscan.log"
/usr/bin/clamscan -i -l "$LOGFILE" -r "$1"
if [ $? -eq 1 ]; then
cd "$1"/..
mv "$BASENAME" _INFECTED_"$BASENAME"
fi
Of course I tested it, and yes it did detect the virus just fine.shypike wrote: Did it find any viruses yet?
Seriously, it hard to tell if it actually works until it catches a virus.
Code: Select all
#!/bin/sh
BASENAME=`basename "$1"`
LOGFILE="$1/clamscan.log"
/usr/bin/clamscan -i -l "$LOGFILE" -r "$1"
if [ $? -eq 1 ]; then
cd "$1"/..
mv "$BASENAME" _INFECTED_"$BASENAME"
echo "Virus found!"
else
echo "All OK - no virus found."
fi