Re: [Cppcms-users] E-Mails Missing
Brought to you by:
artyom-beilis
From: Василий Т. <par...@gm...> - 2015-12-28 11:44:02
|
Helo, Artyom. Unfortunately (or, better, fortunately), I can't reproduce my previous troubles with pid file overwriting. May be, that was my mistake, and the pid file was replaced by init script while created by the daemon. Anyway, pid file creation after setuid is not convinient for me. I would stay with systemd if you dont mind :) Current systemd config ("daemon" section is absent in cppcms config): ------------------ [Unit] Description=Lightning app server After=network.target [Service] ExecStart=/opt/lightning/lightning Type=simple ExecReload=/bin/kill -HUP $MAINPID ExecStop=/bin/kill $MAINPID Restart=on-abnormal User=www-data [Install] WantedBy=multi-user.target ------------------ Thanks for support! Andrey 2015-12-26 16:03 GMT+03:00 Artyom Beilis <art...@gm...>: > I meant all the code, config files including systemd configuration and > sample app. If you can reproduce it on 'hello world' example. > > Because I have just tested it and it works as expected > > On Saturday, December 26, 2015, Василий Теркин <par...@gm...> > wrote: > > step by step: > > 1) use daemon config with fork, setuid and pid file > > On second start the daemon replaces its old pid file, finds the socket > being busy and exits. Thus we got healthy daemon and incorrect pid file. > > 2) put pid file handling inside init script: > > PID=`$DAEMON $DAEMONOPT... ans so on > > The daemon unable to setuid by itself. > > Direct call without ` lets the daemon setuid successfully, but i can't > handle pid file again. > > 3) simplest systemd config resolves all the problems, the daemon starts > as regular application. > > Unfortunately, everything is at work - i can't get configs right now > (very typical ones). > > 2015-12-26 14:12 GMT+03:00 Artyom Beilis <art...@gm...>: > >> > >> First of all CppCMS can setuid for you: > >> http://cppcms.com/wikipp/en/page/cppcms_1x_config#daemon > >> > >> You can provide both user and group and the process would setuid from > root to limited account while being capable > >> of listening on ports like 80. > >> Now if you start the process like this PID=`$DAEMON $DAEMONOPT and > saving PID file to lock file it would indeed not work. > >> CppCMS service creates its own lock file and daemonizes itself. Service > PID is stored in the lock file and its content > >> should be used to stop to process and check if it is up. > >> Can you show your full systemd configuration and your CppCMS config. > >> Artyom > >> P.S.: If you don't mind send a reply to CppCMS users list so others can > learn and probably help. > >> On Sat, Dec 26, 2015 at 12:47 PM, Василий Теркин <par...@gm...> > wrote: > >>> > >>> 2015-12-26 0:34 GMT+03:00 Artyom Beilis <art...@gm...>: > >>>> > >>>> > >>>> On Fri, Dec 25, 2015 at 11:19 PM, Василий Теркин < > par...@gm...> wrote: > >>>>> > >>>>> Hello, Artyom. That's right - no questions, no answers. > >>>> > >>>> > >>>> Can you find them in Spam or they just gone? The one regarding CppCMS > 1.1 progress is just from few days ago. > >>> > >>> oh, sh%t.. i'am very sorry - that's my fault > >>> I have two merged gmail accouts: google downloads everything from > par...@gm... and let me write emails on behalf of both. > >>> But the issue is spam - it never gets into "parent" account, and > that's why i hadn't found it. > >>> I apologize. > >>> > >>>>> > >>>>> * one more thing.. cppcms has an daemon option with pid file, but it > doesn't use it itself. If the daemon starts second time it replaces the old > pid file, finds the socket being busy and exits. Thus we got healthy daemon > and incorrect pid file. Thanks to systemd - all of these daemon options may > not be used or customized by myself. > >>>> > >>>> Actually it shouldn't be like that the lock file is not overwritten > when it exists . You get socket in use (as it in use) but PID file > >>>> should remain unmodified. > >>>> Are you sure it works the way you described? It shouldn't. Can it be > the case you "remove" lock file before process starts > >>>> as "cleanup"? > >>> > >>> It works exactly this way for me. This is the only reason i got to > know systemd (and i found it to be very convenient). > >>> Plus, when daemon start command is nested into sh command (typical: > PID=`$DAEMON $DAEMONOPTS > /dev/null 2>&1 & echo $!`) > >>> the daemon is unable to setuid. Thus, resolving one problem creates > another one. > >>> Thanks again for feedback. > >>> Andrey > > > > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |