List Info

Thread: Re: dbmail-imapd stopped after SIGHUP




Re: dbmail-imapd stopped after SIGHUP
country flaguser name
Russian Federation
2007-08-21 10:16:38
Somebody read this mailing list? 

> Hello!
> We're uging DBMail 2.2.5 from EPEL (Extra Packages for
Enterprise Linux by RedHat/Fedora Project) - http://download.fedora.redhat.com/pub/epel
/5/i386/repoview/dbmail.html .
> Sources of dbmail from EPEL contains next patch:
> ------------------------ begin patch
> Index: server.c
>
============================================================
=======
> --- server.c    (revision 2646)
> +++ server.c    (revision 2647)
>  -172,20 +172,36 
>         return Restart;
>  }
> -pid_t server_daemonize(serverConfig_t *conf)
> +/* Should be called after a HUP to allow for log
rotation,
> + * as the filesystem may want to give us new inodes
and/or
> + * the user may have changed the log file configs. */
> +static void reopen_logs(serverConfig_t *conf)
>  {
>         int serr;
> -       assert(conf);
> +
> +       if (! (freopen(conf->log, "a",
stdout))) {
> +               serr = errno;
> +               TRACE(TRACE_ERROR, "freopen failed
on [%s] [%s]",
> +                               conf->log,
strerror(serr));
> +       }
> +       if (! (freopen(conf->error_log,
"a", stderr))) {
> +               serr = errno;
> +               TRACE(TRACE_ERROR, "freopen failed
on [%s] [%s]",
> +                               conf->error_log,
strerror(serr));
> +       }
> +       if (! (freopen("/dev/null",
"r", stdin))) {
> +               serr = errno;
> +               TRACE(TRACE_ERROR, "freopen failed
on stdin [%s]",
> +                               strerror(serr));
> +       }
> +}
> -       if (fork())
> -               exit(0);
> -       setsid();
> -       if (fork())
> -               exit(0);
> +/* Should be called once to initially close the actual
std{in,out,err}
> + * and open the redirection files. */
> +static void reopen_logs_fatal(serverConfig_t *conf)
> +{
> +       int serr;
> -       chdir("/");
> -       umask(0077);
> -
>         if (! (freopen(conf->log, "a",
stdout))) {
>                 serr = errno;
>                 TRACE(TRACE_FATAL, "freopen failed
on [%s] [%s]",
>  -201,7 +217,23 
>                 TRACE(TRACE_FATAL, "freopen failed
on stdin [%s]",
>                                 strerror(serr));
>         }
> +}
> +pid_t server_daemonize(serverConfig_t *conf)
> +{
> +       assert(conf);
> +
> +       if (fork())
> +               exit(0);
> +       setsid();
> +       if (fork())
> +               exit(0);
> +
> +       chdir("/");
> +       umask(0077);
> +
> +       reopen_logs_fatal(conf);
> +
>         TRACE(TRACE_DEBUG, "sid: [%d]",
getsid(0));
>         return getsid(0);
>  -225,6 +257,8 
>         int serrno, status, result = 0;
>         pid_t pid = -1;
> +       reopen_logs(conf);
> +
>         CreateSocket(conf);
>         switch ((pid = fork())) {
> ------------------------ end patch
> I noticed than exist bug http://dbmai
l.org/mantis/view.php?id=600 .
> DBMail built with patch above but in any case
dbmail-imapd just stop sometimes on logrotate (e.g.
receiving SIGHUP).
> How to solve this problem?
> --
> Ilyas
> _______________________________________________
> DBmail mailing list
> DBmaildbmail.org
> htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail
_______________________________________________
DBmail mailing list
DBmaildbmail.org
htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail

Re: dbmail-imapd stopped after SIGHUP
country flaguser name
United States
2007-08-21 11:26:34
Yes, however I don't have anything further to report on the
SIGHUP issue.
I cannot reproduce the reported problems. Perhaps there is
something
peculiar about the RedHat environment that is causing
trouble?

Aaron

On Tue, Aug 21, 2007, umask <umaskyandex.ru> said:

> Somebody read this mailing list? 
> 
>> Hello!
>> We're uging DBMail 2.2.5 from EPEL (Extra Packages
for Enterprise Linux by RedHat/Fedora Project) - http://download.fedora.redhat.com/pub/epel
/5/i386/repoview/dbmail.html .
>> Sources of dbmail from EPEL contains next patch:
>> ------------------------ begin patch
>> Index: server.c
>>
============================================================
=======
>> --- server.c    (revision 2646)
>> +++ server.c    (revision 2647)
>>  -172,20 +172,36 
>>         return Restart;
>>  }
>> -pid_t server_daemonize(serverConfig_t *conf)
>> +/* Should be called after a HUP to allow for log
rotation,
>> + * as the filesystem may want to give us new
inodes and/or
>> + * the user may have changed the log file configs.
*/
>> +static void reopen_logs(serverConfig_t *conf)
>>  {
>>         int serr;
>> -       assert(conf);
>> +
>> +       if (! (freopen(conf->log, "a",
stdout))) {
>> +               serr = errno;
>> +               TRACE(TRACE_ERROR, "freopen
failed on [%s] [%s]",
>> +                               conf->log,
strerror(serr));
>> +       }
>> +       if (! (freopen(conf->error_log,
"a", stderr))) {
>> +               serr = errno;
>> +               TRACE(TRACE_ERROR, "freopen
failed on [%s] [%s]",
>> +                               conf->error_log,
strerror(serr));
>> +       }
>> +       if (! (freopen("/dev/null",
"r", stdin))) {
>> +               serr = errno;
>> +               TRACE(TRACE_ERROR, "freopen
failed on stdin [%s]",
>> +                               strerror(serr));
>> +       }
>> +}
>> -       if (fork())
>> -               exit(0);
>> -       setsid();
>> -       if (fork())
>> -               exit(0);
>> +/* Should be called once to initially close the
actual std{in,out,err}
>> + * and open the redirection files. */
>> +static void reopen_logs_fatal(serverConfig_t
*conf)
>> +{
>> +       int serr;
>> -       chdir("/");
>> -       umask(0077);
>> -
>>         if (! (freopen(conf->log, "a",
stdout))) {
>>                 serr = errno;
>>                 TRACE(TRACE_FATAL, "freopen
failed on [%s] [%s]",
>>  -201,7 +217,23 
>>                 TRACE(TRACE_FATAL, "freopen
failed on stdin [%s]",
>>                                 strerror(serr));
>>         }
>> +}
>> +pid_t server_daemonize(serverConfig_t *conf)
>> +{
>> +       assert(conf);
>> +
>> +       if (fork())
>> +               exit(0);
>> +       setsid();
>> +       if (fork())
>> +               exit(0);
>> +
>> +       chdir("/");
>> +       umask(0077);
>> +
>> +       reopen_logs_fatal(conf);
>> +
>>         TRACE(TRACE_DEBUG, "sid: [%d]",
getsid(0));
>>         return getsid(0);
>>  -225,6 +257,8 
>>         int serrno, status, result = 0;
>>         pid_t pid = -1;
>> +       reopen_logs(conf);
>> +
>>         CreateSocket(conf);
>>         switch ((pid = fork())) {
>> ------------------------ end patch
>> I noticed than exist bug http://dbmai
l.org/mantis/view.php?id=600 .
>> DBMail built with patch above but in any case
dbmail-imapd just stop sometimes on logrotate (e.g.
receiving SIGHUP).
>> How to solve this problem?
>> --
>> Ilyas
>> _______________________________________________
>> DBmail mailing list
>> DBmaildbmail.org
>> htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail
> _______________________________________________
> DBmail mailing list
> DBmaildbmail.org
> htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail
> 

-- 



_______________________________________________
DBmail mailing list
DBmaildbmail.org
htt
ps://mailman.fastxs.nl/mailman/listinfo/dbmail

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )