Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
> Cron script for hourly Clamscan
JustRoy
post Oct 13 2014, 04:56 PM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 1
Joined: 13-October 14
Member No.: 18,791



I have a problem with this cron script. When I run it from the terminal, it works fine.

However, when cron runs the script, clamscan gives an error:
ERROR: --file-list: Can't open file /tmp/clamscan.MLXep5

CODE
#!/usr/bin/bash
# Create Hourly Cron Job With Clamscan

# Directories to scan
SCAN_DIR=/home/transmission/Downloads

# Temporary file
LIST_FILE=`mktemp /tmp/clamscan.XXXXXX`

# Location of log file
LOG_FILE=/var/log/clamav/hourly_clamscan.log

# Make list of new files
/usr/bin/find "$SCAN_DIR" -type f -mmin -60 -fprint ${LIST_FILE}
# Scan files and remove infected
/usr/bin/clamscan -i -f ${LIST_FILE} --remove > $LOG_FILE

# If there were infected files detected, send email alert
if [ `cat ${LOG_FILE}  | grep Infected | grep -v 0 | wc -l` != 0 ]
then
        echo "$(egrep "FOUND" $LOG_FILE)" | /bin/mail -s "VIRUS PROBLEM" -r clam@nas.local #####@#####.##
fi
exit


Can't seem to figure it out.
Go to the top of the page
 
+Quote Post

Posts in this topic
- JustRoy   Cron script for hourly Clamscan   Oct 13 2014, 04:56 PM


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 18th November 2017 - 10:46 AM