[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-date: Fri Feb 20 10:55:30 2004 -->
- <!--x-from-r13: xrvgu ng vdgi.pbz (Yrvgu [beevf - WC) -->
- <!--x-message-id: [email protected] -->
- <!--x-subject: [ale] shell scripting baby questions... -->
- <li><em>date</em>: Fri Feb 20 10:55:30 2004</li>
- <li><em>from</em>: keith at iqtv.com (Keith Morris - IQ)</li>
- <li><em>subject</em>: [ale] shell scripting baby questions...</li>
I'm starting out will shell scripting (so new I'm still wet behind the
ears) and am writing my first really useful script. I am using
BitDefender free command line virus scanner to scan for virii and
working on a script to automate the process to put into a cron job. the
basic functionality is working except for the checking to see if any
virii were detected. I'm not clear on the string/binary operators in
the if statement and can't get it to work out correctly.
If someone has time and would be willing to look at this script and 1.
help me get the virii log detection working, and 2. possibly show me a
couple of hints to make this more efficient. Thanks.
--- start script ---
#!/bin/bash
#
# Script to run BitDefender nightly and report
# the full scan as well as create an infected
# file report
#
# file and path variables
reportTime=`date +%y%m%d_%H%M%S`;
logName="scan_$reportTime.log";
infectedLogName="infected_$reportTime.log";
logPath="/home/samba/production/vlogs";
dirToScan="/home/samba/production";
# update virus defs
/opt/bdc/bdc --update;
# run virus scan with logging
/opt/bdc/bdc --arc --disinfect --log=$logPath/$logName $dirToScan;
# list all found infected files into an infected log
cat $logPath/$logName | grep infected: > $logPath/$infectedLogName;
# find out if there were any found infections
infectionsDetected=`cat $logPath/$infectedLogName | wc -l`;
# if no virii were detected, deleted infected log file.
# *!!! this ain't workin' !!!*
if [ $infectionsDetected eq "0" ]
then
rm -f $logPath/$infectedLogName
fi
# tar and gzip the scan logfile and remove the uncompressed log
tar -czf $logPath/$LogName.tgz $logPath/$infectedLogName;
rm -f $logPath/$logName;
--- end script ---
--
:: Keith Morris
:: Creative Director
:: Design / Effects
:: IQ television group
:: Atlanta, GA
:: 404.255.3550
:: <a rel="nofollow" href="http://www.iqtv.com">http://www.iqtv.com</a>
</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00745" href="msg00745.html">[ale] shell scripting baby questions...</a></strong>
<ul><li><em>From:</em> lists at cybertechcafe.net (Nathan J. Underwood)</li></ul></li>
<li><strong><a name="01075" href="msg01075.html">[ale] shell scripting baby questions...</a></strong>
<ul><li><em>From:</em> deepbsd at earthlink.net (David S. Jackson)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00742.html">[ale] PCI USB card</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00744.html">[ale] shell scripting baby questions...</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00742.html">[ale] PCI USB card</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00745.html">[ale] shell scripting baby questions...</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00743"><strong>Date</strong></a></li>
<li><a href="threads.html#00743"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>