I created the following script that I schedule that deletes 0 byte files
and moves files from the undeliver directory back into the spool. I
currently try and send it 5 times, after that it gives up and renames it
so I can look at it later.  Seems to work for us.
-Erik

<cfdirectory action="LIST" directory="/opt/coldfusion/mail/spool"
name="deletezerobytefiles" filter="*.cfmail" >
<CFLOOP QUERY="deletezerobytefiles">
<CFIF size LTE 0 >
<CFFILE ACTION="DELETE" FILE="/opt/coldfusion/mail/spool/#name#">
</CFIF>
</CFLOOP>


<cfset tries = '1' >
<cfset totaltries = '5' >
<CFDIRECTORY Directory="/opt/coldfusion/mail/undelivr"
Name="Undeliverables" FILTER="*.cfmail">

<CFLOOP query="Undeliverables">

<CFFILE ACTION="READ"
FILE="/opt/coldfusion/mail/undelivr/#NAME#" VARIABLE="xfile">

<cfif xfile contains "x-cf-tries">

<cfset StartPos = FindNoCase('x-cf-tries:', xfile)>
<cfset tries = replace(trim(mid(xfile,StartPos,
14)), 'x-cf-tries:', '', 'all') >
<cfset newtries = incrementvalue(tries)>
</cfif>

<cfif tries GTE #totaltries# >

<cffile action="MOVE"
source="/opt/coldfusion/mail/undelivr/#NAME#"

destination="/opt/coldfusion/mail/undelivr/#NAME#_failed">

<cfelse>

<CFFILE ACTION="DELETE"
FILE="/opt/coldfusion/mail/undelivr/#NAME#"> <!--- delete the file --->


<cfif isdefined("newtries")>

<CFSET xfile = replace(xfile, 'x-cf-tries: #trim
(tries)#',  'x-cf-tries: #newtries#', 'all') >

<cfelse>

<CFSET xfile = replace(xfile, 'x-cf-timeout',  'x-
cf-tries: 1 x-cf-timeout:', 'all') >

</cfif>

<CFFILE ACTION="WRITE"
FILE="/opt/coldfusion/mail/spool/#NAME#" OUTPUT="#xfile#" ADDNEWLINE="No">

</cfif>

</CFLOOP>

</cfif>


>
>> The zero-length mail file bug was fixed in CF 5.0, I am 99%
>> positive (I didn't do the fix).
>
> Hey Tom!
>
> I think everyone's missed one detail here.  Ryan...  You said that you
> found a file in the spool that was causing this problem...  Was is zero
> bytes?  If not, this is a different problem.
>
> You said you "copied" the undeliverable message from the undelivr
> folder into the spool?  Did you rename it?  What if it failed to get
> delivered again (CF probably checks the spool at service startup), it
> fails again, and when CF tries to move the file into the undelivr
> folder, whoops, a file by that name already exists.
>
> Wonder how CF handles this internally?  If it doesn't know to rename
> the file perhaps it just freaks out and blows chunks?  I don't have a
> Linux install handy, but it would be easy enough to try a test case...
> Just copy (not move) a message from undelivr into spool and see what
> happens.
>
> -Cameron
>
> --------------------
> Cameron Childress
> elliptIQ Inc.
> p.770.460.1035.232
> f.770.460.0963
> --
> http://www.neighborware.com
> America's Leading Community Network Software
>
>
>
>
>
>> -----Original Message-----
>> From: Tom Jordahl [mailto:[EMAIL PROTECTED]]
>> Sent: Thursday, December 13, 2001 4:56 PM
>> To: CF-Linux
>> Subject: RE: Cold Fusion keeps restarting, help!
>>
>>
>> Ryan, Tim,
>>
>> Send the offending mail spool file along with a bug report to
>> Macromedia technical support.  They should be able to work it
>> through channels and get a hot fix.
>>
>> The zero-length mail file bug was fixed in CF 5.0, I am 99%
>> positive (I didn't do the fix).
>> --
>> Tom Jordahl
>> Macromedia Server Development
>>
>>
>> -----Original Message-----
>> From: Tim Storm [mailto:[EMAIL PROTECTED]]
>> Sent: Thursday, December 13, 2001 4:41 PM
>> To: CF-Linux
>> Subject: Re: Cold Fusion keeps restarting, help!
>>
>>
>> This is a far too common problem that we experience - think we can get
>> a comment/fix from the allaire folks?
>>
>> We had to write a cron script to run every minute to check to see if
>> cf services are responding... if not, we delete the spool folder and
>> restart cf
>> automatically....
>>
>> Ugly, but effective
>>
>> Tim Storm
>> FatWallet.Com
>>
>> ----- Original Message -----
>> From: "Ryan" <[EMAIL PROTECTED]>
>> To: "CF-Linux" <[EMAIL PROTECTED]>
>> Sent: Thursday, December 13, 2001 3:33 PM
>> Subject: Re: Cold Fusion keeps restarting, help!
>>
>>
>> > Got it (doesn't that always happen right after I finally decide
>> to ask the
>> > list about it?). I found a post on the Allaire forums saying one
>> > person
>> had
>> > the same problem and they found a zero byte mail message in the
>> > spool folder. Once they deleted it, the problem went away. So I
>> > checked the
>> spool
>> > folder, and there was a file in there that I had copied from
>> the undelivr
>> > folder.  (The mail message was fine, it just got put in the undelivr
>> folder
>> > because CF just sometimes does that). So I removed the message from
>> > both the spool folder and the undelivr folder and the server stopped
>> restarting.
>> >
>> > That's very wierd.  I wonder if I would have been better of moving
>> > it to spool instead of copying it? I think I've copied messages from
>> undelivr to
>> > spool before, but that was on a Windoze CF box.r
>> >
>> > Thanks for any input.
>> >
>> > -Ryan
>> >
>>
>>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-linux%40houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_linux or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to