rc.local question/problem

Paul Allen Newell pnewell at cs.cmu.edu
Sun Jul 3 03:40:43 UTC 2011


I am trying to run clamav from rc.local so it happens whenever I power 
on and/or reboot. Script fails as though it can't open anything. Running 
the script as root works like a champ. Am I mistaken in thinking that I 
can run any *.sh file in ~root in rc.local and it will be run as root 
(meaning no permission problems).

Line in /etc/rc.d/rc.local:
/root/virus-scan.sh > /dev/null 2>&1

Summary of version in ~root/virus-scan.sh
#!/bin/sh
COMMON_DIRS="/home /tmp" # skipping all /bin /sbin et al for this test
/usr/bin/clamscan -ri $COMMON_DIRS --log="/var/log/clamscan.log"

Contents of log show /home as "can't open" and certain files in /tmp as 
"Permission denied"

Searching the web found only one forum that had a "doesn't work in 
rc.local, works if run as root command shell" but there is no answer to 
it. All the other links show different rc.local problems such as "isn't 
being run" and I can verify that my rc.local is being run

I have a call to "freshclam -d -c 2 -l /var/log/clam-update.log" that is 
working (though I keep getting out-of-date notice followed by up-to-date 
output when actually checking --- I'm trying to sort this out on clamav 
/ Fedora man pages)

Thanks in advance for any help (and let me know if I need to provide any 
more info)
Paul


More information about the users mailing list