<p dir="ltr">find -delete may not be present in all platforms. It may be replaced with find -exec rm \{}; IIRC</p>
<div class="gmail_quote">On Feb 19, 2014 9:39 AM, &quot;Kevin Kobb&quot; &lt;<a href="mailto:kkobb@skylinecorp.com">kkobb@skylinecorp.com</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
It would probably be more efficient to use the find &quot;-delete&quot; action<br>
rather than &quot;xargs rm -rf&quot;, but either should work.<br>
<br>
On a side note, does anybody have plans to carve out an &quot;old style&quot;<br>
MailScanner tarball with the fixes from GitHub? i.e. a new 4.8xx release?<br>
<br>
Thanks<br>
<br>
On 2/15/2014 7:17 AM, Jethro R Binks wrote:<br>
&gt; My script was written for FreeBSD.  If you&#39;re using a different operating system, you&#39;ll need to read the manual page for your &#39;find&#39; command and modify it accordingly.<br>
&gt;<br>
&gt;&gt; On 15 Feb 2014, at 09:08, Remco Barendse &lt;<a href="mailto:mailscanner@barendse.to">mailscanner@barendse.to</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; I slightly modified the script, if i remove &quot;-maxdepth 1&quot;  from opts the<br>
&gt;&gt; script completes without errors and i included /tmp.<br>
&gt;&gt; However, the find command doesn&#39;t find the files. Even when i set days to<br>
&gt;&gt; 1, i still find files that are 3-4 days old.<br>
&gt;&gt;<br>
&gt;&gt; When i do :<br>
&gt;&gt;    find /var/spool/MailScanner/incoming/SpamAssassin-Temp/ -name &#39;tmp.*&#39;<br>
&gt;&gt; it finds all the files, when i add &quot;-mtime +1&quot; it doesn&#39;t find anything<br>
&gt;&gt; anymore.<br>
&gt;&gt;<br>
&gt;&gt; Clues anyone?  Could it be that mtime doesn&#39;t work on zero byte files?<br>
&gt;&gt;<br>
&gt;&gt; Thanks!<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;&gt; On Wed, 12 Feb 2014, Jethro R Binks wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I&#39;ve run this nightly for years which may help:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; #!/bin/sh<br>
&gt;&gt;&gt; ##<br>
&gt;&gt;&gt; ## MailScanner, SpamAssassin and so on tend to leave files around, so this<br>
&gt;&gt;&gt; ## will clean up any more than $days old<br>
&gt;&gt;&gt; ##<br>
&gt;&gt;&gt; ## v2.1<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; # Defined in MailScanner.conf, &quot;Incoming Work Dir&quot;:<br>
&gt;&gt;&gt; MSWORK=/mail/scanner/incoming<br>
&gt;&gt;&gt; # Defined in MailScanner.conf, &quot;SpamAssassin Temporary Dir&quot;:<br>
&gt;&gt;&gt; #SATMP=/tmp<br>
&gt;&gt;&gt; SATMP=$MSWORK/SpamAssassin-Temp<br>
&gt;&gt;&gt; # Defined in clamd.conf, &quot;TemporaryDirectory&quot;:<br>
&gt;&gt;&gt; CLAMAVTMP=/var/tmp<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; days=&quot;2&quot;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; opts=&quot;-mtime +$days -maxdepth 1&quot;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; find $SATMP -name &#39;.spamassassin*&#39; $opts | xargs rm -rf<br>
&gt;&gt;&gt; find $SATMP -name &#39;update_spamassassin*&#39; $opts | xargs rm -rf<br>
&gt;&gt;&gt; find $MSWORK -name &#39;[0-9]*&#39; -type d $opts | xargs rm -rf<br>
&gt;&gt;&gt; find $CLAMAVTMP -name &#39;packlist.*&#39; -type f $opts | xargs rm -rf<br>
&gt;&gt;&gt; find $CLAMAVTMP -name &#39;checkholddir.*&#39; -type f $opts | xargs rm -rf<br>
&gt;&gt;&gt; find $CLAMAVTMP -name &#39;clamav-*&#39; $opts | xargs rm -rf<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; On Wed, 12 Feb 2014, Remco Barendse wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; I know the subject was discussed on the mailing list several times but i<br>
&gt;&gt;&gt;&gt; didn&#39;t find the ultimate solution.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Does anyone have a super duper cleanup script for all the files in :<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; /tmp<br>
&gt;&gt;&gt;&gt; for files like  tmp.DPhoj31724<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; /var/spool/MailScanner/incoming/SpamAssassin-Temp<br>
&gt;&gt;&gt;&gt; for files like  .spamassassin3805xUDKuUtmp<br>
&gt;&gt;&gt;&gt;                  MailScanner.0aOrDx<br>
&gt;&gt;&gt;&gt;                  tmp.IKiiOy6683<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; They are seriously clogging up my filesystem and slowing down the system.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; I tried to script something based on the age of the file but it didn&#39;t<br>
&gt;&gt;&gt;&gt; work (maybe because most are zero byte files).<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Thanks!<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Remco<br>
&gt;&gt;&gt;&gt; --<br>
&gt;&gt;&gt;&gt; MailScanner mailing list<br>
&gt;&gt;&gt;&gt; <a href="mailto:mailscanner@lists.mailscanner.info">mailscanner@lists.mailscanner.info</a><br>
&gt;&gt;&gt;&gt; <a href="http://lists.mailscanner.info/mailman/listinfo/mailscanner" target="_blank">http://lists.mailscanner.info/mailman/listinfo/mailscanner</a><br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Before posting, read <a href="http://wiki.mailscanner.info/posting" target="_blank">http://wiki.mailscanner.info/posting</a><br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Support MailScanner development - buy the book off the website!<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .<br>
&gt;&gt;&gt; Jethro R Binks, Network Manager,<br>
&gt;&gt;&gt; Information Services Directorate, University Of Strathclyde, Glasgow, UK<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; The University of Strathclyde is a charitable body, registered in<br>
&gt;&gt;&gt; Scotland, number SC015263.<br>
&gt;&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; MailScanner mailing list<br>
&gt;&gt; <a href="mailto:mailscanner@lists.mailscanner.info">mailscanner@lists.mailscanner.info</a><br>
&gt;&gt; <a href="http://lists.mailscanner.info/mailman/listinfo/mailscanner" target="_blank">http://lists.mailscanner.info/mailman/listinfo/mailscanner</a><br>
&gt;&gt;<br>
&gt;&gt; Before posting, read <a href="http://wiki.mailscanner.info/posting" target="_blank">http://wiki.mailscanner.info/posting</a><br>
&gt;&gt;<br>
&gt;&gt; Support MailScanner development - buy the book off the website!<br>
--<br>
MailScanner mailing list<br>
<a href="mailto:mailscanner@lists.mailscanner.info">mailscanner@lists.mailscanner.info</a><br>
<a href="http://lists.mailscanner.info/mailman/listinfo/mailscanner" target="_blank">http://lists.mailscanner.info/mailman/listinfo/mailscanner</a><br>
<br>
Before posting, read <a href="http://wiki.mailscanner.info/posting" target="_blank">http://wiki.mailscanner.info/posting</a><br>
<br>
Support MailScanner development - buy the book off the website!<br>
</blockquote></div>