Mailing List Archive

pid-file
I'm setting up a mailsystem using exim and mailscanner, therefore I have
two exim-processes runnning.

One only queue messages and is started: /pack/exim-4.05/bin/exim -bd
Using a default configuration file, that says (and a lot more)
queue_only = true
spool_directory = /var/spool/exim_incomming

When it is started it creates /var/spool/exim_incomming/exim-daemon.pid
containing the pid of the exim proces

However the other exim proces, that does the delevery, is started using:
/pack/exim-4.05/bin/exim -C /etc/eximmail/exim_outgoing.conf -q30m
In that configuration file I have added:
spool_directory = /var/spool/exim
Although that is the default for my exim-binary.

Using this setup only the first exim proces creates a pid-file (in
/var/spool/exim_incomming/exim-daemon-pid), the other proces does not
create a pid-file (One would expect it to be created as
/var/spool/exim/exim-daemon-pid)

Is this a bug or a feature or can I give exim som option that forces it
to create a pid-file ? (I have tried adding pid_file_path =
/var/spool/exim/exim-daemon.pid in the configuration file)

The doku says:

"When a listening daemon is started without the use of -oX (that is,
without overriding the normal configuration), it writes its process id to
a file called exim-daemon.pid in Exim's spool directory."

That might give me a clue as to why the file is not created, however I
really would like to have it :-)

Any advice ?

Regards

-Michael

--
Michael Collin Nielsen mailto:michael@hum.auc.dk
M.Sc.E.E. http://www.hum.auc.dk/~michael
Sysadm in Faculty of Humanities, Aalborg University
Re: pid-file [ In reply to ]
On Wed, 10 Jul 2002, Michael Collin Nielsen wrote:

> However the other exim proces, that does the delevery, is started using:
> /pack/exim-4.05/bin/exim -C /etc/eximmail/exim_outgoing.conf -q30m
>
> Using this setup only the first exim proces creates a pid-file (in

Exim 3 tried to be clever with daemon pids, and got itself into a
tangle. I made things much simpler in Exim 4.

> Is this a bug or a feature or can I give exim som option that forces it

Feature.

> "When a listening daemon is started without the use of -oX (that is,
> without overriding the normal configuration), it writes its process id to
> a file called exim-daemon.pid in Exim's spool directory."
>
> That might give me a clue as to why the file is not created, however I
> really would like to have it :-)
>
> Any advice ?

Read the NewStuff file as well as the manual. :-) The following change
was made for Exim 4.01:

2. There is a new command line option -oP which allows the pid file path to
be specified on the command line. The rules for deciding whether an Exim
daemon should write a pid file have been changed and are now as follows:

. A pid file is not written unless the -bd option is used (that is, daemons
created with -q that don't do SMTP listening are esoteric beasts that
don't count).

. A pid file is not written when -oX is used to override the SMTP port or
the interfaces, unless -oP is used to specify a path explicitly.

(I'll be updating the manual for the next release.)

--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.
Re: pid-file [ In reply to ]
On Wed, 10 Jul 2002, Philip Hazel wrote:
> On Wed, 10 Jul 2002, Michael Collin Nielsen wrote:
>
> > However the other exim proces, that does the delevery, is started using:
> > /pack/exim-4.05/bin/exim -C /etc/eximmail/exim_outgoing.conf -q30m
> >
> > Using this setup only the first exim proces creates a pid-file (in
>
> Exim 3 tried to be clever with daemon pids, and got itself into a
> tangle. I made things much simpler in Exim 4.
>
> > Is this a bug or a feature or can I give exim som option that forces it
>
> Feature.

Ofcourse :-)

> > "When a listening daemon is started without the use of -oX (that is,
> > without overriding the normal configuration), it writes its process id to
> > a file called exim-daemon.pid in Exim's spool directory."
> >
> > That might give me a clue as to why the file is not created, however I
> > really would like to have it :-)
> >
> > Any advice ?
>
> Read the NewStuff file as well as the manual. :-) The following change
> was made for Exim 4.01:
>
> 2. There is a new command line option -oP which allows the pid file path to
> be specified on the command line. The rules for deciding whether an Exim
> daemon should write a pid file have been changed and are now as follows:
>
> . A pid file is not written unless the -bd option is used (that is, daemons
> created with -q that don't do SMTP listening are esoteric beasts that
> don't count).
>
> . A pid file is not written when -oX is used to override the SMTP port or
> the interfaces, unless -oP is used to specify a path explicitly.
>
> (I'll be updating the manual for the next release.)

Thanks, that explains why I can't get exim to create the pid-file.
Wouldn't it be useful to have an option that tells exim to write the
pid-file disregarding the rules you outlined ? Well... I would find it
very usefull :-)

Regards

-Michael
--
Michael Collin Nielsen mailto:michael@hum.auc.dk
M.Sc.E.E. http://www.hum.auc.dk/~michael
Sysadm in Faculty of Humanities, Aalborg University
Re: pid-file [ In reply to ]
On Wed, 10 Jul 2002, Michael Collin Nielsen wrote:

> > . A pid file is not written when -oX is used to override the SMTP port or
> > the interfaces, unless -oP is used to specify a path explicitly.
> >
> > (I'll be updating the manual for the next release.)
>
> Thanks, that explains why I can't get exim to create the pid-file.
> Wouldn't it be useful to have an option that tells exim to write the
> pid-file disregarding the rules you outlined ? Well... I would find it
> very usefull :-)

Er, the -oP option is supposed to do just that. If you give it -oP, it
will always write a pid file.

--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.
Re: pid-file [ In reply to ]
On Wed, 10 Jul 2002, Philip Hazel wrote:
> On Wed, 10 Jul 2002, Michael Collin Nielsen wrote:
>
> > > . A pid file is not written when -oX is used to override the SMTP port or
> > > the interfaces, unless -oP is used to specify a path explicitly.
> > >
> > > (I'll be updating the manual for the next release.)
> >
> > Thanks, that explains why I can't get exim to create the pid-file.
> > Wouldn't it be useful to have an option that tells exim to write the
> > pid-file disregarding the rules you outlined ? Well... I would find it
> > very usefull :-)
>
> Er, the -oP option is supposed to do just that. If you give it -oP, it
> will always write a pid file.

Hmmm, I can't get it to write the pid-file when the process is started
with the following options:

/pack/exim-4.05/bin/exim -C /etc/eximmail/exim_outgoing.conf \
-oP /var/spool/exim/exim-daemon.pid \
-q30m

I don't get a /var/spool/exim/exim-daemon.pid file :-/

I've had a glance at the code, and I can see that the code that writes to
the pid-file is the last piece of code in the blok executed if
daemin_listen is true (in daemon.c):

if (daemon_listen)
{
...lots of code
code for writing to pid-file
}

Ie, if the exim proces is not a listening daemon, then a pid-file will
never be written.

In my case using the command above the exim proces does not listen,
therefore it will never create a pid-file.

Is this intentional ?

Regards

-Michael


--
Michael Collin Nielsen mailto:michael@hum.auc.dk
M.Sc.E.E. http://www.hum.auc.dk/~michael
Sysadm in Faculty of Humanities, Aalborg University
Re: pid-file [ In reply to ]
This is a PGP signed message sent according to RFC3156 [PGP/MIME]
--
In message
<Pine.GSO.4.10.10207101417080.3718-100000@hercules.humfak.auc.dk>,
Michael Collin Nielsen <michael@hum.auc.dk> writes
>On Wed, 10 Jul 2002, Philip Hazel wrote:
>> On Wed, 10 Jul 2002, Michael Collin Nielsen wrote:
>>
>> > > . A pid file is not written when -oX is used to override the
>> > >port or
>> > > the interfaces, unless -oP is used to specify a path explicitly.
>> > >
>> > > (I'll be updating the manual for the next release.)
>> >
>> > Thanks, that explains why I can't get exim to create the pid-file.
>> > Wouldn't it be useful to have an option that tells exim to write the
>> > pid-file disregarding the rules you outlined ? Well... I would find it
>> > very usefull :-)
>>
>> Er, the -oP option is supposed to do just that. If you give it -oP, it
>> will always write a pid file.
>
>Hmmm, I can't get it to write the pid-file when the process is started
>with the following options:
>
>/pack/exim-4.05/bin/exim -C /etc/eximmail/exim_outgoing.conf \
> -oP /var/spool/exim/exim-daemon.pid \
> -q30m
>
>I don't get a /var/spool/exim/exim-daemon.pid file :-/

Me neither.

Without one, I am unsure how to write the script to stop it. ( Excuse
any ignorance here, I am a newbie ).
>I've had a glance at the code,
[snip]
>Ie, if the exim proces is not a listening daemon, then a pid-file will
>never be written.
...

Regards
--
Dave English,
Client Software Development, Thus PLC,
Dorking Business Park, DORKING, Surrey, UK. RH4 1HJ
http://www.thus.net
--
[ Content of type application/pgp-signature deleted ]
--
Re: pid-file [ In reply to ]
On Wed, 10 Jul 2002, Michael Collin Nielsen wrote:

> Ie, if the exim proces is not a listening daemon, then a pid-file will
> never be written.

Ooops. Sorry. My apologies. I had a thinko and was talking nonsense again.

> In my case using the command above the exim proces does not listen,
> therefore it will never create a pid-file.
>
> Is this intentional ?

It was intentional that daemons without -bd shouldn't write pid files by
default (because -q-only daemons are 'anomalous').

I clearly overlooked this when I later added the -oP option. It
certainly seems right that if you specify -oP, it should override all
the defaults and force a pid file write.

I'll fix it for the next release - hopefully that will be out within the
next two weeks. I'm just doing final tidying and getting the
documentation updated.


--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.
Re: pid-file [ In reply to ]
* On Wed, Jul 10, 2002 at 02:53:08PM BST, Dave English <davide@turnpike.com> wrote:
> This is a PGP signed message sent according to RFC3156 [PGP/MIME]
> --
> In message
> <Pine.GSO.4.10.10207101417080.3718-100000@hercules.humfak.auc.dk>,
> Michael Collin Nielsen <michael@hum.auc.dk> writes
> >I don't get a /var/spool/exim/exim-daemon.pid file :-/
>
> Me neither.
>
> Without one, I am unsure how to write the script to stop it. ( Excuse
> any ignorance here, I am a newbie ).

It appears to me that, if you didn't specify the location of the pid
file in the Makefile when you compiled, then it will be called
exim-daemon.pid and be in the Exim spool directory (wherever that is
in your installation).

It should be a plain text file with a number, indicating Exim's
process ID, followed by a line feed.

To find it, you could try:

locate exim-daemon.pid

or look in the Makefile to see if its location was explicitly defined.

A script to kill Exim could simply contain:

kill `cat /path/to/pid-file`

or

kill $(cat /path/to/pid-file)


--
Simon <simon@no-dns-yet.org.uk> **** PGP: 099977D0
"We demand rigidly defined areas of doubt and uncertainty."
- Douglas Adams
Re: pid-file [ In reply to ]
This is a PGP signed message sent according to RFC3156 [PGP/MIME]
--
In message <20020710192333.GA21993@no-dns-yet.org.uk>, Simon Williams
<simon@no-dns-yet.org.uk> writes
>* On Wed, Jul 10, 2002 at 02:53:08PM BST, Dave English
><davide@turnpike.com> wrote:
>> This is a PGP signed message sent according to RFC3156 [PGP/MIME]
>> --
>> In message
>> <Pine.GSO.4.10.10207101417080.3718-100000@hercules.humfak.auc.dk>,
>> Michael Collin Nielsen <michael@hum.auc.dk> writes
>> >I don't get a /var/spool/exim/exim-daemon.pid file :-/
>>
>> Me neither.
>>
>> Without one, I am unsure how to write the script to stop it. ( Excuse
>> any ignorance here, I am a newbie ).
>
>It appears to me that, if you didn't specify the location of the pid
>file in the Makefile when you compiled, then it will be called
>exim-daemon.pid and be in the Exim spool directory (wherever that is
>in your installation).

But you don't get a .pid file if it is not a demon, that is the point.
When I run with -bd then a .pid file is created - either at the path
that I set in the Makefile or the one that I specified a the -oP. But
without a -bd, for the deliver only queue runner, no .pid file is
created whether I use a -oP or not.

Now Philip will fix that in the next minor release, but I was just
wondering what I could do in the meantime - apart from killing them by
hand, that is.

>It should be a plain text file with a number, indicating Exim's
>process ID, followed by a line feed.
>
>To find it, you could try:
>
>locate exim-daemon.pid
>
>or look in the Makefile to see if its location was explicitly defined.
>
>A script to kill Exim could simply contain:
>
>kill `cat /path/to/pid-file`
>
>or
>
>kill $(cat /path/to/pid-file)

Thanks anyway
--
Dave English,
Client Software Development, Thus PLC,
Dorking Business Park, DORKING, Surrey, UK. RH4 1HJ
http://www.thus.net
--
[ Content of type application/pgp-signature deleted ]
--
Re: pid-file [ In reply to ]
* On Thu, Jul 11, 2002 at 10:44:01AM BST, Dave English <paulo@turnpike.com> wrote:
> In message <20020710192333.GA21993@no-dns-yet.org.uk>, Simon Williams
> <simon@no-dns-yet.org.uk> writes
> >It appears to me that, if you didn't specify the location of the pid
> >file in the Makefile when you compiled, then it will be called
> >exim-daemon.pid and be in the Exim spool directory (wherever that is
> >in your installation).
>
> But you don't get a .pid file if it is not a demon, that is the point.
> When I run with -bd then a .pid file is created - either at the path
> that I set in the Makefile or the one that I specified a the -oP. But
> without a -bd, for the deliver only queue runner, no .pid file is
> created whether I use a -oP or not.
>
> Now Philip will fix that in the next minor release, but I was just
> wondering what I could do in the meantime - apart from killing them by
> hand, that is.

Ah, I see now. You could try something like this in a shell script
called from a cron job (depending on your needs/reasons for killing
the queue-runner) to avoid doing it by hand all of the time:

kill $(ps auxwww | grep exim | grep -v grep | grep -v -- -bd | \
awk '{print $2}')

That should work under Linux & FreeBSD. I believe it should work
under Solaris if you replace 'pa auxwww' with 'ps -ao user,args',
but I'm not near a Solaris machine at the moment.


--
Simon Williams <simon@no-dns-yet.org.uk> **** PGP: 099977D0
"We demand rigidly defined areas of doubt and uncertainty."
- Douglas Adams
Re: pid-file [ In reply to ]
On Thu, 11 Jul 2002, Simon Williams wrote:

> kill $(ps auxwww | grep exim | grep -v grep | grep -v -- -bd | \
> awk '{print $2}')
>
> That should work under Linux & FreeBSD. I believe it should work
> under Solaris if you replace 'pa auxwww' with 'ps -ao user,args',
> but I'm not near a Solaris machine at the moment.

That would (as I read it) kill all Exim processes that were neither -bd
daemons, nor spawned from -bd daemons. That isn't what you want. You'd
kill off reception processes spawned by MUAs.

What you could do is run exiwhat to find the process you want.

--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.
Re: pid-file [ In reply to ]
> > Now Philip will fix that in the next minor release, but I was just
>> wondering what I could do in the meantime - apart from killing them by
>> hand, that is.
>
>Ah, I see now. You could try something like this in a shell script
>called from a cron job (depending on your needs/reasons for killing
>the queue-runner) to avoid doing it by hand all of the time:

One possibility, I have no idea if it will work, would be to use the
csh to execute the command and %1 to kill it, Ie:

/wherever/exim -whatever &
kill %1

Also, when started like that from csh, it prints out the job number and pid:

[1] 7132

Perhaps that would help?

Enjoy,
Peter.

--
<http://www.interarchy.com/> <http://download.interarchy.com/>
Re: pid-file [ In reply to ]
* On Thu, Jul 11, 2002 at 03:25:33PM BST, Philip Hazel <ph10@cus.cam.ac.uk> wrote:
> On Thu, 11 Jul 2002, Simon Williams wrote:
> > kill $(ps auxwww | grep exim | grep -v grep | grep -v -- -bd | \
> > awk '{print $2}')
> >
> > That should work under Linux & FreeBSD. I believe it should work
> > under Solaris if you replace 'pa auxwww' with 'ps -ao user,args',
> > but I'm not near a Solaris machine at the moment.
>
> That would (as I read it) kill all Exim processes that were neither -bd
> daemons, nor spawned from -bd daemons. That isn't what you want. You'd
> kill off reception processes spawned by MUAs.

Having had another look, it seems you're right.

> What you could do is run exiwhat to find the process you want.

I've spotted the following states using exiwhat so far:

The listening daemon:
7639 daemon: -q5m, listening for SMTP

Either a queue-runner or a sub-process of a queue-runner?:
27981 delivering 17Sf0y-0007HI-00

Spawned to handle an incoming connection:
30852 handling incoming connection from machine [x.x.x.x]

A queue-runner or sub-process of a queue-runner that needed to spawn
a sub-process for the delivery:
8118 delivering 17SfIg-00026v-00: waiting for a remote delivery
subprocess to finish
8119 delivering 17SfIg-00026v-00 to machine [x.x.x.x] (email-addr)

I have a feeling I still haven't found the one called by the MUA,
despite having tried to send a 35MB file (bigger when UUEncoded)
locally and running 'while (true); do /usr/exim/bin/exiwhat; done'.

grepping for set_process_info in the Exim source (4.05), it seems
that 'accepting a local non-SMTP message from <%s>' is used for
accepting mails from MUAs. Is this right?

In that case, would this be better for killing queue-runners?:

kill $(/path/to/exiwhat | grep -v daemon | grep -v handling | \
grep -v accepting | awk '{print $1}')


--
Simon Williams <simon@no-dns-yet.org.uk> **** PGP: 099977D0
"We demand rigidly defined areas of doubt and uncertainty."
- Douglas Adams
Re: pid-file [ In reply to ]
On Thu, 11 Jul 2002, Simon Williams wrote:

> grepping for set_process_info in the Exim source (4.05), it seems
> that 'accepting a local non-SMTP message from <%s>' is used for
> accepting mails from MUAs. Is this right?

Correct for non-SMTP messages. If the MUA uses SMTP, you'll see
"handling incoming connection from ...".

> In that case, would this be better for killing queue-runners?:
>
> kill $(/path/to/exiwhat | grep -v daemon | grep -v handling | \
> grep -v accepting | awk '{print $1}')

Er, I think the plot has gone astray here. Or I'm confused. My
recollection was that nobody wanted to kill individual queue runners.
What the original poster wanted was to start a daemon with something
like -q15m but NOT -bd, and find a way of killing *that daemon*
conveniently. Its process should show up in exiwhat as a daemon, without
the "listening" stuff.

(BTW, your command would kill processes that are "delivering"...)

--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.
Re: pid-file [ In reply to ]
* On Thu, Jul 11, 2002 at 04:50:52PM BST, Philip Hazel <ph10@cus.cam.ac.uk> wrote:
> On Thu, 11 Jul 2002, Simon Williams wrote:
> > In that case, would this be better for killing queue-runners?:
> >
> > kill $(/path/to/exiwhat | grep -v daemon | grep -v handling | \
> > grep -v accepting | awk '{print $1}')
>
> Er, I think the plot has gone astray here. Or I'm confused.

The former, I think.

> My
> recollection was that nobody wanted to kill individual queue runners.
> What the original poster wanted was to start a daemon with something
> like -q15m but NOT -bd, and find a way of killing *that daemon*
> conveniently. Its process should show up in exiwhat as a daemon, without
> the "listening" stuff.
>
> (BTW, your command would kill processes that are "delivering"...)

In that case, something like this?:

kill $(/path/to/exiwhat | grep daemon | grep -v listening | \
awk '{print $1}')


--
Simon Williams <simon@no-dns-yet.org.uk> **** PGP: 099977D0
"We demand rigidly defined areas of doubt and uncertainty."
- Douglas Adams
Re: pid-file [ In reply to ]
On Thu, 11 Jul 2002, Simon Williams wrote:

> In that case, something like this?:
>
> kill $(/path/to/exiwhat | grep daemon | grep -v listening | \
> awk '{print $1}')

Bingo.

--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.