diff -Nur e-smith-lib-2.6.0.bz9659.old/root/usr/share/perl5/vendor_perl/esmith/util.pm e-smith-lib-2.6.0.bz9659.new/root/usr/share/perl5/vendor_perl/esmith/util.pm --- e-smith-lib-2.6.0.bz9659.old/root/usr/share/perl5/vendor_perl/esmith/util.pm 2016-02-05 23:44:16.000000000 +0100 +++ e-smith-lib-2.6.0.bz9659.new/root/usr/share/perl5/vendor_perl/esmith/util.pm 2016-07-13 01:13:03.770539849 +0200 @@ -542,7 +542,7 @@ sleep $delaySec; # execute command - exec { $command[0] } @command; + exec { $command[0] } @command or warn "Can't @command : $!\n"; } =pod @@ -1121,32 +1121,47 @@ if ( $serviceAction =~ /^(start|stop|restart|reload|graceful|adjust|svdisable)$/ ) { - my ($startScript) = glob("/etc/rc.d/rc7.d/S*$serviceName"); - unless ( -e $startScript ) + my ($startScript) = glob("/etc/rc.d/rc7.d/S*$serviceName") ||'' ; + my ($systemdScript) = "/usr/lib/systemd/system/$serviceName.service" ||''; + + unless ( -e $startScript or -e $systemdScript) { warn "serviceControl: startScript not found " . "for service $serviceName\n"; return 0; } - my $background = $params{'BACKGROUND'} || 'false'; + if (-e $systemdScript and ! -e $startScript){ + if ($serviceAction =~/^(start|stop|restart|reload)$/) { + system('/usr/bin/systemctl',"$serviceAction","$serviceName.service") == '0' + || warn "serviceControl: Couldn't " . + "system( /usr/bin/systemctl $serviceAction $serviceName.service): $!\n"; + } + else { + die "serviceControl: systemd doesn't know : systemctl $serviceAction $serviceName.service"; + } + } + + elsif (-e $startScript) { + my $background = $params{'BACKGROUND'} || 'false'; - if ( $background eq 'true' ) - { + if ( $background eq 'true' ) + { backgroundCommand( 0, $startScript, $serviceAction ); - } - elsif ( $background eq 'false' ) - { - unless ( system( $startScript, $serviceAction ) == 0 ) + } + elsif ( $background eq 'false' ) { + unless ( system( $startScript, $serviceAction ) == 0 ) + { warn "serviceControl: " . "Couldn't system($startScript, $serviceAction): $!\n"; return 0; - } - } - else - { + } + } + else + { die "serviceControl: Unsupported BACKGROUND=>$background"; + } } } else