<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>cronjob &#8211; lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</title>
	<atom:link href="http://lifelinux.com/tag/cronjob/feed/" rel="self" type="application/rss+xml" />
	<link>http://lifelinux.com</link>
	<description>All About Linux !</description>
	<lastBuildDate>Sat, 20 Sep 2014 09:19:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.3</generator>
	<item>
		<title>How To Use ClamAV &#038; Cron Jobs To Run Daily And Hourly Virus Scans</title>
		<link>http://lifelinux.com/how-to-use-clamav-cron-jobs-to-run-daily-and-hourly-virus-scans/</link>
					<comments>http://lifelinux.com/how-to-use-clamav-cron-jobs-to-run-daily-and-hourly-virus-scans/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 20 Sep 2014 08:20:07 +0000</pubDate>
				<category><![CDATA[Anti Virus]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[clamav crontab]]></category>
		<category><![CDATA[clamav daily scan]]></category>
		<category><![CDATA[clamav hourly scan]]></category>
		<category><![CDATA[contab]]></category>
		<category><![CDATA[cronjob]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=1935</guid>

					<description><![CDATA[<p>Clam AntiVirus (ClamAV) is a free and open-source, cross-platform antivirus software tool-kit able to detect many types of malicious software, including viruses. In the previous article, I shown you &#8220;How To Install/Compile ClamAV In CentOS 6&#8220;. In this article, I will continue to show you How to use ClamAV &#038; Cronjobs to run daily &#038; [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-use-clamav-cron-jobs-to-run-daily-and-hourly-virus-scans/">How To Use ClamAV &#038; Cron Jobs To Run Daily And Hourly Virus Scans</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>Clam AntiVirus (ClamAV) is a free and open-source, cross-platform antivirus software tool-kit able to detect many types of malicious software, including viruses. In the previous article, I shown you &#8220;<a href="http://www.lifelinux.com/how-to-installcompile-clamav-in-centos-6/">How To Install/Compile ClamAV In CentOS 6</a>&#8220;. In this article, I will continue to show you How to use ClamAV &#038; Cronjobs to run daily &#038; hourly virus scans.<span id="more-1935"></span></p>
<p>The first, I will create a new directory to store script &#038; log files of ClamAV</p>
<pre>
# mkdir -p /usr/local/clamav/script
# mkdir -p /usr/local/clamav/log
</pre>
<h2>Setting up hourly scans</h2>
<p>Creating a file called name <strong>clamscan_hourly</strong></p>
<pre>
# vi /usr/local/clamav/script/clamscan_hourly
</pre>
<p>And add the following code</p>
<pre>
#!/bin/bash
SUBJECT="`hostname` PASSED HOURLY SCAN"
EMAIL="admin@domain.com"
LOG=/usr/local/clamav/log/clamav.log
TMP_LOG=/tmp/clam.hourly
 
av_report() {
 
    if [ `cat ${TMP_LOG}  | grep Infected | grep -v 0 | wc -l` != 0 ]
    then
		SUBJECT="[WARNING] `hostname` PASSED HOURLY SCAN"
    fi
	
	EMAILMESSAGE=`mktemp /tmp/virus-alert.XXXXX`
    echo "To: ${EMAIL}" >>  ${EMAILMESSAGE}
    echo "From: alert@domain.com" >>  ${EMAILMESSAGE}
    echo "Subject: ${SUBJECT}" >>  ${EMAILMESSAGE}
    echo "Importance: High" >> ${EMAILMESSAGE}
    echo "X-Priority: 1" >> ${EMAILMESSAGE}
    echo "`tail -n 50 ${TMP_LOG}`" >> ${EMAILMESSAGE}
    sendmail -t < ${EMAILMESSAGE}
	
	cat ${TMP_LOG} >> ${LOG}
	rm -rf ${TMP_LOG}
}

av_scan() {
	touch ${TMP_LOG}
	find / -not -wholename '/sys/*' -and -not -wholename '/proc/*' -mmin -61 -type f -print0 | xargs -0 -r clamscan --exclude-dir=/proc/ --exclude-dir=/sys/ --quiet --infected --log=${TMP_LOG}
}

av_scan
av_report
freshclam
</pre>
<p>Save the file. Make sure it’s executable, type</p>
<pre>
# chmod +x /usr/local/clamav/script/clamscan_hourly
</pre>
<h2>Setting up daily scans</h2>
<p>Creating a file called name <strong>clamscan_daily</strong></p>
<pre>
# vi /usr/local/clamav/script/clamscan_daily
</pre>
<p>And add the following code</p>
<pre>
#!/bin/bash
SUBJECT="`hostname` PASSED DAILY SCAN"
EMAIL="admin@domain.com"
LOG=/usr/local/clamav/log/clamav.log
TMP_LOG=/tmp/clam.daily
 
av_report() {
 
    if [ `cat ${TMP_LOG}  | grep Infected | grep -v 0 | wc -l` != 0 ]
    then
	SUBJECT="[WARNING] `hostname` PASSED DAILY SCAN"
    fi
	
	EMAILMESSAGE=`mktemp /tmp/virus-alert.XXXXX`
    echo "To: ${EMAIL}" >>  ${EMAILMESSAGE}
    echo "From: alert@domain.com" >>  ${EMAILMESSAGE}
    echo "Subject: ${SUBJECT}" >>  ${EMAILMESSAGE}
    echo "Importance: High" >> ${EMAILMESSAGE}
    echo "X-Priority: 1" >> ${EMAILMESSAGE}
    echo "`tail -n 50 ${TMP_LOG}`" >> ${EMAILMESSAGE}
    sendmail -t < ${EMAILMESSAGE}
	
	cat ${TMP_LOG} >> ${LOG}
	rm -rf ${TMP_LOG}
}

av_scan() {
	touch ${TMP_LOG}
	clamscan -r / --exclude-dir=/sys/ --quiet --infected --log=${TMP_LOG}
}
 
av_scan
av_report
</pre>
<p>Save the file. Make sure it’s executable, type</p>
<pre>
# chmod +x /usr/local/clamav/script/clamscan_daily
</pre>
<h2>Setting Up Crontab to run ClamAV hourly &#038; daily scans </h2>
<p>Type the following command</p>
<pre>
# crontab -e
</pre>
<p>Add the following code</p>
<pre>
# ClamAV scan
01 * * * * /usr/local/clamav/script/clamscan_hourly
01 00 * * * /usr/local/clamav/script/clamscan_daily
</pre>
<h2>Setting up log rotation for ClamAV</h2>
<p>Creating a file called name <strong>clamav</strong>, type</p>
<pre>
# vi /etc/logrotate.d/clamav
</pre>
<p>Add the following code</p>
<pre>
/usr/local/clamav/log/*.log {
    daily
    dateext
    dateformat -%d%m%Y
    missingok
    rotate 90
    compress
    delaycompress
    notifempty
    create 600 root root
}
</pre>
<g:plusone href="http://lifelinux.com/how-to-use-clamav-cron-jobs-to-run-daily-and-hourly-virus-scans/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-use-clamav-cron-jobs-to-run-daily-and-hourly-virus-scans/">How To Use ClamAV &#038; Cron Jobs To Run Daily And Hourly Virus Scans</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/how-to-use-clamav-cron-jobs-to-run-daily-and-hourly-virus-scans/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Auto Update CentOS Server With yum Command</title>
		<link>http://lifelinux.com/auto-update-centos-server-with-yum-command/</link>
					<comments>http://lifelinux.com/auto-update-centos-server-with-yum-command/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 23 Nov 2010 08:42:09 +0000</pubDate>
				<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[auto update]]></category>
		<category><![CDATA[auto yum update]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[cronjob]]></category>
		<category><![CDATA[yum]]></category>
		<category><![CDATA[yum update]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=50</guid>

					<description><![CDATA[<p>The yum command is used to install and update software under Centos, RedHat and Fedora. In this topic, i will use yum command to update Centos and configure yum to update automatically with Crontab. Create file yum_update.sh vi /etc/cron.daily/yum_update.sh With following content : #!/bin/bash /usr/bin/yum -y -R 120 -d 0 -e 0 update yum /usr/bin/yum [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/auto-update-centos-server-with-yum-command/">Auto Update CentOS Server With yum Command</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>The <strong>yum command</strong> is used to install and update software under Centos, RedHat and Fedora. In this topic, i will use yum command to update Centos and configure yum to update automatically with Crontab.<span id="more-50"></span></p>
<p>Create file yum_update.sh</p>
<pre>vi /etc/cron.daily/yum_update.sh</pre>
<p>With following content :</p>
<pre>#!/bin/bash

/usr/bin/yum -y -R 120 -d 0 -e 0 update yum

/usr/bin/yum -y -R 10 -e 0 -d 0 update</pre>
<p>-e 0 -d 0  are to only show critical errors.<br />
-R adds random delay between command execution.</p>
<p>Make it executable</p>
<pre>chmod 755 /etc/cron.daily/yum_update.sh</pre>
<g:plusone href="http://lifelinux.com/auto-update-centos-server-with-yum-command/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/auto-update-centos-server-with-yum-command/">Auto Update CentOS Server With yum Command</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/auto-update-centos-server-with-yum-command/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
