1 |
stephdl |
1.1 |
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 |
2 |
|
|
--- 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 |
3 |
|
|
+++ 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 |
4 |
|
|
@@ -542,7 +542,7 @@ |
5 |
|
|
sleep $delaySec; |
6 |
|
|
|
7 |
|
|
# execute command |
8 |
|
|
- exec { $command[0] } @command; |
9 |
|
|
+ exec { $command[0] } @command or warn "Can't @command : $!\n"; |
10 |
|
|
} |
11 |
|
|
|
12 |
|
|
=pod |
13 |
|
|
@@ -1121,32 +1121,47 @@ |
14 |
|
|
|
15 |
|
|
if ( $serviceAction =~ /^(start|stop|restart|reload|graceful|adjust|svdisable)$/ ) |
16 |
|
|
{ |
17 |
|
|
- my ($startScript) = glob("/etc/rc.d/rc7.d/S*$serviceName"); |
18 |
|
|
- unless ( -e $startScript ) |
19 |
|
|
+ my ($startScript) = glob("/etc/rc.d/rc7.d/S*$serviceName") ||'' ; |
20 |
|
|
+ my ($systemdScript) = "/usr/lib/systemd/system/$serviceName.service" ||''; |
21 |
|
|
+ |
22 |
|
|
+ unless ( -e $startScript or -e $systemdScript) |
23 |
|
|
{ |
24 |
|
|
warn "serviceControl: startScript not found " |
25 |
|
|
. "for service $serviceName\n"; |
26 |
|
|
return 0; |
27 |
|
|
} |
28 |
|
|
|
29 |
|
|
- my $background = $params{'BACKGROUND'} || 'false'; |
30 |
|
|
+ if (-e $systemdScript and ! -e $startScript){ |
31 |
|
|
+ if ($serviceAction =~/^(start|stop|restart|reload)$/) { |
32 |
|
|
+ system('/usr/bin/systemctl',"$serviceAction","$serviceName.service") == '0' |
33 |
|
|
+ || warn "serviceControl: Couldn't " . |
34 |
|
|
+ "system( /usr/bin/systemctl $serviceAction $serviceName.service): $!\n"; |
35 |
|
|
+ } |
36 |
|
|
+ else { |
37 |
|
|
+ die "serviceControl: systemd doesn't know : systemctl $serviceAction $serviceName.service"; |
38 |
|
|
+ } |
39 |
|
|
+ } |
40 |
|
|
+ |
41 |
|
|
+ elsif (-e $startScript) { |
42 |
|
|
+ my $background = $params{'BACKGROUND'} || 'false'; |
43 |
|
|
|
44 |
|
|
- if ( $background eq 'true' ) |
45 |
|
|
- { |
46 |
|
|
+ if ( $background eq 'true' ) |
47 |
|
|
+ { |
48 |
|
|
backgroundCommand( 0, $startScript, $serviceAction ); |
49 |
|
|
- } |
50 |
|
|
- elsif ( $background eq 'false' ) |
51 |
|
|
- { |
52 |
|
|
- unless ( system( $startScript, $serviceAction ) == 0 ) |
53 |
|
|
+ } |
54 |
|
|
+ elsif ( $background eq 'false' ) |
55 |
|
|
{ |
56 |
|
|
+ unless ( system( $startScript, $serviceAction ) == 0 ) |
57 |
|
|
+ { |
58 |
|
|
warn "serviceControl: " |
59 |
|
|
. "Couldn't system($startScript, $serviceAction): $!\n"; |
60 |
|
|
return 0; |
61 |
|
|
- } |
62 |
|
|
- } |
63 |
|
|
- else |
64 |
|
|
- { |
65 |
|
|
+ } |
66 |
|
|
+ } |
67 |
|
|
+ else |
68 |
|
|
+ { |
69 |
|
|
die "serviceControl: Unsupported BACKGROUND=>$background"; |
70 |
|
|
+ } |
71 |
|
|
} |
72 |
|
|
} |
73 |
|
|
else |