[WBEL-users] Using cron for auto tasks

Ewan Mac Mahon ecm103@york.ac.uk
Fri, 27 Feb 2004 15:53:12 +0000


On Thu, Feb 26, 2004 at 12:25:35PM -0600, Pete Cervasio wrote:
> On Thursday 26 February 2004 11:02, Sharon Kimble wrote:
> > You are exactly right, sylpheed is a GUI-app [my favourite email proggie
> > :) ] and it barfs wehn run through cron. Any ideas how to get it to
> > display please?
> 
> Hi Sharon.  The reason it doesn't like to run from cron is most likely because 
> the DISPLAY variable isn't set. 

That's probably the immediate problem, and setting DISPLAY in the cron
script would get round it but only if the right user is logged in at the
time; if the OP's going to leave herself logged in the whole time I wonder
if Sylpheed couldn't just be left running. Furthermore even if you set
DISPLAY manually there are going to be a load of other environment
variables that will be unset/set different from cron than from a normal
session that could have all sorts of odd effects.


I think that fundamentally this is just plain the wrong way do do it;
Sylpheed's being used for two things, firstly pulling the emails from the
ISP's server, and secondly presenting them in a gui. I think the right way
to do this is to separate the two jobs. There's a thing called fetchmail
which doesn't need X or an interactive console and is perfect for running
from cron; as its name suggests it fetches mail from a remote server, but
rather than presenting it straight to the user it just drops it in a local
mailbox. Then once it's done its thing from cron overnight you get up in
the morning, log in, start Sylpheed, but rather than pointing it at your
ISP you tell it to get your mail from the local box where fetchmail
dropped it. It's the Right Way(TM) to do it and it's a lot less failure
prone than trying to start X apps from cron.

Ewan