Malcolm Weir wrote:
> I'm generally of the opinion that cleanup is best placed in the startup
> scripts (e.g. /etc/init.d/whatever) rather than in the application proper.
>    
I thought this at first. However, I do not know of a reliable way to 
enumerate user accounts across all courier-imap installations. I'd 
imagine that it doesn't make sense for a system-wide initscript to snoop 
into every user's ~/.maildir :-). But... maybe I could fit a lock 
inspection/cleanup script that triggers when a user logs in.

Of course, my system is private (personal). I know nothing of managing 
large-scale operations.
> One of the several reasons is that if you want more sophisticated cleanup
> than a simple "rm -f /tmp/courier.lock"  e.g. something like this...
>    
Note that ./tmp/courier.lock actually refers to 
~username/.maildir/.subfoldername/tmp/courier.lock. If the lock was 
systemwide, I would throw the simple rm -f /tmp/courier.lock into my 
initscript.

However, the Trash folder of an account was locked. This confused me 
because seamonkey's (a.k.a. Mozilla MailNews' (a.k.a. Thunderbird's)) 
default ``delete'' action is to ``move message to Trash''. This caused 
me to freeze up an IMAP connection when  asking seamonkey to delete 
messages from Inbox (causing me to take an amount of time to find the 
lockfile).
> PID=`some awk / cut / expr thing to extract the pid</tmp/courier.lock`
> PSSTAT=`ps -edf | grep $PID`
> if [ "$PSSTAT" != "" ]
> then
>       PSPROC=`some awk / cut / expr thing to extract the process's
> executable's name`
>
>       if [ "$PSPROC" = "courier-imap" ]
>       then
>               echo "You crazy?  The daemon is already running."
>               exit 1
>       fi
> fi
> rm -f /tmp/courier.lock
>    
This is the type of script I may be able to throw into the 
semi-initscripts called by couriertcpd (IIRC). I think this is 
synonymous to courier-imapd checking /proc/self/exe, though Sam noted it 
isn't portable.

-- 
binki


------------------------------------------------------------------------------
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to