Mint Serena 64 bit using the Mate desktop environment. Most of the following scripts will run on this machine, although some have only been tested with the Gnome desktop. Extra software requirements can be met by the Ubuntu and safe PPA repositories. Scripts may be re-written or added to from time to time, the date serves as the version number. Syntax highlighting on these pages is provided by GVim's "Convert to HTML" option.

Automate ClamAV antivirus

# Filename: ClamAV-scan
# Version: 291110
# Author: robz
# This runs clamscan via a "user crontab", scans reports & logs to your home
# directory every 3 days, or alter to your prefs. "30 19 */3 * * export
# DISPLAY=:0 && /home//.scripts/ClamAV-scan > /dev/null 2>&1" all on one
# line without the enclosing quotes.
# The patched notify-osd package is reqd. see this page for an explanation.
# You might also need to "sudo chmod 444" some files to allow read access for
# "others", something to check if script fails see below.

LOGFILE="$HOME/ClamAV-scan-for-$(date +%A-%H:%M).log"
SUBJECT="ClamAV scan report:"
TARGET=/home/robz1                                  # Where to scan.
SOUND=$HOME/Audio/HyprBlip.wav                      # Warning sound (file.wav)
ICON=$HOME/Pictures/user_graphics/Icons/clam.png    # Find yourself an icon.
BBCOL="bubble-background-color = "

mod_osd ()                                          # Mod colours etc.
sed -i "s/bubble-background-color.*/${BBCOL}/" $OSDRC
pkill notify-osd; notify-send -i "$ICON" "$SUBJECT"
# Next bit returns notify-osd to original check yours in "~/.notify-osd"
sed -i 's/bubble-background-color.*/bubble-background-color = 131313/' $OSDRC
/usr/bin/canberra-gtk-play --loop 2 --volume 6 -f $SOUND &
sleep 10; pkill notify-osd

rm -f "$HOME/ClamAV-scan-for-"*.log                 # Junk old logfile.
echo -e "$SUBJECT - $(date)\n" > $LOGFILE           # Create new logfile.
echo -e "Script: $(basename $0) v$VERSION - for user: $LOGNAME" >> $LOGFILE
echo -e "Scanmode: Recursive\nFiles Scanned: $TARGET" >> $LOGFILE

# If nessesary, may fail otherwise!
sudo chmod 444 /var/lib/clamav/bytecode.cld /var/lib/clamav/main.cld\

# Read man clamscan to configure, this may require a tweak or not.
nice -n 19 /usr/bin/clamscan\
CLAMSCAN=$?                                         # Exit status.

if [ "$CLAMSCAN" -eq "1" ]; then
    BBCOL=$BBCOL"ff0000"; mod_osd                   # Red osd warning.
elif [ "$CLAMSCAN" -gt "1" ]; then
    BBCOL=$BBCOL"0000ff"; mod_osd                   # Blue advisory.
else SUBJECT=$SUBJECT" No virus Found"
    SOUND=$HOME/Audio/2tone.wav                     # All OK sound (file.wav)
    BBCOL=$BBCOL"00cc00"; mod_osd                   # Green OK, nothing found.

Powered by ScribeFire.

No comments: