delete obsolete scripts, and archive
This commit is contained in:
parent
733ef9e412
commit
e4b8dc7c0b
2 changed files with 0 additions and 85 deletions
|
|
@ -1,59 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Scans NAS for viruses and alerts users
|
||||
# Uses avira and clamav ATM
|
||||
USERS="foo@example.org"
|
||||
SCANDIR="/mnt/nas_movies /mnt/nas_music /mnt/nas_p2p /mnt/nas_software /mnt/nas_upload"
|
||||
LOGFILE="/root/virus_scan_$(date +%d_%m_%Y).log"
|
||||
SCANNER=( "avscan -s --batch --log-file=$LOGFILE $SCANDIR"
|
||||
"clamscan -r -i -l $LOGFILE $SCANDIR"
|
||||
)
|
||||
LOGGER=$(which logger)
|
||||
|
||||
|
||||
for i in $(seq 1 $(echo ${#SCANNER[*]})); do
|
||||
LOG_NAME="$(basename $0)_$i_$(date +%d_%m_%Y)_XXXXXX"
|
||||
mktemp -t $LOG_NAME
|
||||
done
|
||||
|
||||
# Logging
|
||||
function logit() {
|
||||
case $2 in
|
||||
error)
|
||||
$LOGGER -si $(basename $0): $1
|
||||
;;
|
||||
*)
|
||||
$LOGGER -i $(basename $0): $1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Mount all noauto things from /etc/fstab
|
||||
for i in $(grep 'nfs.*noauto' /etc/fstab | awk '{print $2}'); do
|
||||
if ! mount $i 2>/dev/null; then logit "Failed mounting $i" "error"; fi
|
||||
done
|
||||
|
||||
# Run all scanners
|
||||
|
||||
COUNTER=0
|
||||
for foo in "${SCANNER[@]}"; do
|
||||
TEMPFILE=$(find /tmp -type f -name $LOG_NAME)
|
||||
|
||||
echo "**********************" > $TEMPFILE
|
||||
echo "* $COUNTER. scanner running with: $foo" >> $TEMPFILE
|
||||
echo "**********************" >> $TEMPFILE
|
||||
$foo
|
||||
sleep 2
|
||||
done
|
||||
|
||||
# Merge all temporary logfiles
|
||||
cat /root/avscan.log /root/clamscan.log > $LOGFILE
|
||||
|
||||
# Send e-mail
|
||||
mail -s "NAS antivirus check" $USERS < $LOGFILE
|
||||
|
||||
# Unmount all noauto things from /etc/fstab
|
||||
sleep 3
|
||||
for i in $(grep 'nfs.*noauto' /etc/fstab | awk '{print $2}'); do
|
||||
if ! umount $i 2>/dev/null; then logit "Failed unmounting $i" "error"; fi
|
||||
done
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Author: Oliver Ladner <oli@lugh.ch>
|
||||
# License: LGPL
|
||||
#
|
||||
# Fetches all your delicious bookmarks
|
||||
# and validates the XML before saving.
|
||||
# Requires xmlstarlet
|
||||
|
||||
DEL_USER=foo
|
||||
DEL_PASS=bar
|
||||
API_URL=api.del.icio.us/v1/posts/all
|
||||
BKP_FILE=/home/username/deliciousbackup.xml
|
||||
|
||||
# When no backup exists, just do it
|
||||
if [ ! -f $BKP_FILE ]; then
|
||||
curl -s https://$DEL_USER:$DEL_PASS@$API_URL > $BKP_FILE
|
||||
else
|
||||
curl -s https://$DEL_USER:$DEL_PASS@$API_URL > $BKP_FILE.tmp
|
||||
if [ $(xmlstarlet validate $BKP_FILE.tmp > /dev/null 2>&1; echo $?) -gt 0 ]; then
|
||||
rm $BKP_FILE.tmp
|
||||
echo "Downloaded XML file not valid. Previous backup preserved."
|
||||
# if XML is valid, move to final destination
|
||||
else
|
||||
mv $BKP_FILE.tmp $BKP_FILE
|
||||
fi
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue