diff -Nur e-smith-lib-2.6.0.old/root/etc/e-smith/events/actions/adjust-services e-smith-lib-2.6.0/root/etc/e-smith/events/actions/adjust-services --- e-smith-lib-2.6.0.old/root/etc/e-smith/events/actions/adjust-services 2016-02-05 17:44:16.000000000 -0500 +++ e-smith-lib-2.6.0/root/etc/e-smith/events/actions/adjust-services 2020-11-16 01:15:19.192000000 -0500 @@ -111,7 +111,8 @@ } } - if (-d "/service/$service") + # if service is supervised and not handled by systemd + if (-d "/service/$service" && glob("/etc/rc7.d/S??$service")) { my $enabled = ($s->prop('status') || 'disabled') eq 'enabled'; adjust_supervised_service($service, @@ -124,8 +125,14 @@ ($enabled && !grep { /^(down|stop|d|once|o)$/ } @actions) ? 'up' : (), ); } + # for service handled by former sysvinit or directly with systemd else { + my $enabled = ($s->prop('status') || 'disabled') eq 'enabled'; + # stop the service if it is now disabled + unshift(@actions,'stop') unless $enabled; + # bring the service up if it is enabled (and we're not stopping it or running it once) + push(@actions,'start') if ($enabled && !grep { /^(down|stop|d|once|o|start|restart|reload-or-restart)$/ } @actions) ; foreach (@actions) { warn "adjusting non-supervised $service ($_)\n"; diff -Nur e-smith-lib-2.6.0.old/root/usr/share/perl5/vendor_perl/esmith/util.pm e-smith-lib-2.6.0/root/usr/share/perl5/vendor_perl/esmith/util.pm --- e-smith-lib-2.6.0.old/root/usr/share/perl5/vendor_perl/esmith/util.pm 2020-11-17 11:06:04.842000000 -0500 +++ e-smith-lib-2.6.0/root/usr/share/perl5/vendor_perl/esmith/util.pm 2020-11-16 01:05:33.057000000 -0500 @@ -1119,7 +1119,7 @@ die "serviceControl: ACTION must be specified"; } - if ( $serviceAction =~ /^(start|stop|restart|reload|graceful|adjust|svdisable|reload-or-restart|try-restart|enable -now)$/ ) + if ( $serviceAction =~ /^(start|stop|restart|reload|graceful|adjust|svdisable|reload-or-restart|try-restart|try-reload-or-restart|enable -now|sigterm|sighup|sigusr1|sigusr2)$/ ) { my ($startScript) = glob("/etc/rc.d/rc7.d/S*$serviceName") ||'' ; my ($systemdScript) = "/usr/lib/systemd/system/$serviceName.service" ||''; @@ -1132,7 +1132,10 @@ } if (-e $systemdScript and ! -e $startScript){ - if ($serviceAction =~/^(start|stop|restart|reload|reload-or-restart|try-restart|enable -now)$/) { + # systemd is not aware of adjust, sigusr1, sigusr2, sigterm, sighup + $serviceAction = ( $serviceAction =~/^(adjust|graceful|sighup|sigusr1|sigusr2)$/ ) ? "reload" : $serviceAction; + $serviceAction = ( $serviceAction eq "sigterm" ) ? "restart" : $serviceAction; + if ($serviceAction =~/^(start|stop|restart|reload|reload-or-restart|try-restart|try-reload-or-restart|enable -now)$/) { system('/usr/bin/systemctl',"$serviceAction","$serviceName.service") == '0' || warn "serviceControl: Couldn't " . "system( /usr/bin/systemctl $serviceAction $serviceName.service): $!\n"; @@ -1145,7 +1148,7 @@ elsif (-e $startScript) { my $background = $params{'BACKGROUND'} || 'false'; - die "serviceControl: Unknown serviceAction $serviceAction" if ($serviceAction =~/^(reload-or-restart|try-restart|enable -now)$/); + die "serviceControl: Unknown serviceAction $serviceAction" if ($serviceAction =~/^(reload-or-restart|try-restart|try-reload-or-restart|enable -now)$/); if ( $background eq 'true' ) { backgroundCommand( 0, $startScript, $serviceAction );