Make mtcClient stop collectd before shutdown

The collectd process has been seen to segfault
in its internal network plugin during system
shutdown.

This update modifies the mtcClient to stop
collectd when it is commanded to reboot the
system.

Change-Id: I681ff45a2afb1ae66d2a929a64027ea3ed75721e
Partial-Bug: 1872979
Signed-off-by: Eric MacDonald <eric.macdonald@windriver.com>
This commit is contained in:
Eric MacDonald 2021-01-25 10:20:05 -05:00
parent 70e8eae049
commit 2d5c5b04ed
1 changed files with 5 additions and 1 deletions

View File

@ -70,11 +70,15 @@ void stop_pmon( void )
{
/* max pipe command response length */
#define PIPE_COMMAND_RESPON_LEN (100)
ilog("Stopping collectd.");
int rc = system("/usr/local/sbin/pmon-stop collectd");
sleep (2);
ilog("Stopping pmon to prevent process recovery during shutdown");
for ( int retry = 0 ; retry < 5 ; retry++ )
{
char pipe_cmd_output [PIPE_COMMAND_RESPON_LEN] ;
int rc = system("/usr/bin/systemctl stop pmon");
rc = system("/usr/bin/systemctl stop pmon");
sleep(2);
/* confirm pmon is no longer active */