[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: tricks for fetchmail and signify



On Sun, 1 Feb 1998, Branden Robinson wrote:

> Here's a couple of tricks I worked up for using fetchmail and signify as
> daemons.  Put these in your .login or .profile .
> 
> First, I wanted to make sure fetchmail was running; answer, just run it
> from the .login, right?  But I didn't want to bitch about "waking up" to
> grab mail that it was going to get in the next five minutes anyway.  So we
> use the handy, dandy pidof command:
> 
> /sbin/pidof /usr/bin/fetchmail >& /dev/null || fetchmail --daemon 300

Hmm. I am using this piece of bash shell scripting to do the trick. I
think yours uses less resources, but here is mine anyway:

if ps -x | grep -v grep | grep -q fetchmail
then :
else fetchmail --daemon 1200 --syslog --all
fi

> The fetchmail solution is a little weak, in that if more than one user is
> fetching mail the pidof command will return pid's for all of them, so
> fetchmail would fail to get started for you if anyone else was using.  In
> practice, only one user (me) fetches mail on my machine.  If more are going
> to do it, fetchmail should probably be run by root anyway.

In my solution, this already works.

> I tried to implement these solutions using the start-stop-daemon, but I
> encountered a number of difficulties with that approach, not the least of
> which was that the "--help" option lied to me; if you give
> start-stop-daemon an option it doesn't recognize, it dies instead of
> passing on those options to the daemon you're calling (with --exec).  Oh
> well.

Use "--" before the arguments you want to pass to the daemon.

> Elegant improvements on these solutions would be most welcome, particularly the
> fetchmail one (how do we determine if a particular user has a running
> fetchmail process without doing an ugly grep/awk through the output of ps?).

Yes, it is ugly. But it works.

> Also, a design goal for me was to make sure these guys do their work dead
> quiet.  If the processes are dead, start them silently.  If they're already
> running, don't whine.

Indeed. That's what we want.

> Somebody ought to put up a "Debian Tips and Tricks" webpage that features
> stuff like the above (hopefully neater things, though).

Yes, please do so if there are enough of these tricks.

Remco


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: