https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5950

           Summary: spamd disconnects from terminal before writing pid file
           Product: Spamassassin
           Version: 3.2.4
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P5
         Component: spamc/spamd
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


Hi all

I'm having a problem with spamd.

When I use both the -rPIDFILE and -d options, the program disconnects from
the terminal before the pidfile is created.  This means that the script
that calls the spamd starts the next program before the pidfile exists. 
If this next command requires to read from that file, it will fail.

Doesn't it make sense to write the pidfile before daemonizing?

simple example:

/usr/local/bin/spamd -d -s "$sdlog" -r "$sdpid" \
    --socketpath="$sdsock" --socketmode 600 || exit

kill -INT `cat "$sdpid"`

I just get "cat: No such file" and the signal doesn't get sent.  The pidfile
shows up shortly afterwards.

Perhaps there is a sensible way to do this that I haven't thought of.

It is possible to poll for the file, eg:

while ( ! [ -e "$sdpid" ] ) || ( ! [ -e "$sdsock" ] )
do
  sleep 1
done

But that is awkward and in more complex situations creates race conditions.

viza


-- 
Configure bugmail: 
https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to