Re: [Cppcms-users] some graceful way to close the CppCMS app
Brought to you by:
artyom-beilis
|
From: Artyom B. <art...@ya...> - 2012-07-02 08:57:12
|
Like any other process:
Do stuff like this:
int main(...)
{
try {
cppcms::service srv(...)
srv.run();
}
catch(std::exception const &) {
//Some problem
return 1;
}
return 0; // exited normally
}
srv.run() returns upon srv.shutdown() (that is called by SIGTERM handler)
Artyom Beilis
--------------
CppCMS - C++ Web Framework: http://cppcms.com/
CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
>________________________________
> From: Lee Elenbaas <lee...@gm...>
>To: Artyom Beilis <art...@ya...>; cpp...@li...
>Sent: Monday, July 2, 2012 10:53 AM
>Subject: Re: [Cppcms-users] some graceful way to close the CppCMS app
>
>
>Is there some way to return an error code to the program that run the cppcms app?
>i would like to provide some conditioned loop in my batch/shell script
>
>
>thanks
>
>
>On Mon, Jul 2, 2012 at 10:34 AM, Artyom Beilis <art...@ya...> wrote:
>
>Two options:
>>
>>
>>1. Send a SIGTERM signal to the application service it will shutdown gracefully.
>>2. >From the application itself, use cppcms::service::shutdown()
>>
>>
>>The open requests that started processing .i.e. it is processed in the thread_pool
>>would be completed. The connections that had not got to thread pool (not started processing)
>>
>>and asynchronous connections will be closed.
>>
>>Artyom Beilis
>>--------------
>>CppCMS - C++ Web Framework: http://cppcms.com/
>>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
>>
>>
>>
>>>________________________________
>>> From: Lee Elenbaas <lee...@gm...>
>>>To: cpp...@li...
>>>Sent: Monday, July 2, 2012 10:17 AM
>>>Subject: [Cppcms-users] some graceful way to close the CppCMS app
>>>
>>>
>>>
>>>Hi All,
>>>
>>>
>>>Is there some gracefull way to close the CppCMS so that it will stop accepting new requests, finish handle the currently open requests and then close down with a given error code.
>>>In my situation i sometimes need to close the app change the configuration and then run it again. And i am looking for a gracefull way to perform that.
>>>(Yes i know that the embeded web server is not for production - but for my case i think it is the best option right now. I would have to bundle a webserver with my app anyway, so using this and configuring it to answer only localhost seems like a good enough option for now)
>>>
>>>--
>>>--
>>>lee
>>>Lee Elenbaas
>>>lee...@gm...
>>>
>>>
>>>------------------------------------------------------------------------------
>>>Live Security Virtual Conference
>>>Exclusive live event will cover all the ways today's security and
>>>threat landscape has changed and how IT managers can respond. Discussions
>>>will include endpoint security, mobile security and the latest in malware
>>>threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>>_______________________________________________
>>>Cppcms-users mailing list
>>>Cpp...@li...
>>>https://lists.sourceforge.net/lists/listinfo/cppcms-users
>>>
>>>
>>>
>>------------------------------------------------------------------------------
>>Live Security Virtual Conference
>>Exclusive live event will cover all the ways today's security and
>>threat landscape has changed and how IT managers can respond. Discussions
>>will include endpoint security, mobile security and the latest in malware
>>threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>_______________________________________________
>>Cppcms-users mailing list
>>Cpp...@li...
>>https://lists.sourceforge.net/lists/listinfo/cppcms-users
>>
>>
>
>
>
>--
>--
>lee
>Lee Elenbaas
>lee...@gm...
>
>
>------------------------------------------------------------------------------
>Live Security Virtual Conference
>Exclusive live event will cover all the ways today's security and
>threat landscape has changed and how IT managers can respond. Discussions
>will include endpoint security, mobile security and the latest in malware
>threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>_______________________________________________
>Cppcms-users mailing list
>Cpp...@li...
>https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
>
> |