1 |
jpp |
1.1 |
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 |
2 |
|
|
--- e-smith-lib-2.6.0.old/root/etc/e-smith/events/actions/adjust-services 2021-01-01 17:54:05.634000000 -0500 |
3 |
|
|
+++ e-smith-lib-2.6.0/root/etc/e-smith/events/actions/adjust-services 2021-01-01 18:00:37.726000000 -0500 |
4 |
|
|
@@ -129,10 +129,10 @@ |
5 |
|
|
else |
6 |
|
|
{ |
7 |
|
|
my $enabled = ($s->prop('status') || 'disabled') eq 'enabled'; |
8 |
|
|
- # stop the service if it is now disabled |
9 |
|
|
- unshift(@actions,'stop') unless $enabled; |
10 |
|
|
- # bring the service up if it is enabled (and we're not stopping it or running it once) |
11 |
|
|
- push(@actions,'start') if ($enabled && !grep { /^(down|stop|d|once|o|start|restart|reload-or-restart)$/ } @actions) ; |
12 |
|
|
+ # bring the service up if it is enabled (and we're not stopping it or running it once, or using signal able to start it) |
13 |
|
|
+ unshift(@actions,'start') if ($enabled && !grep { /^(down|stop|d|once|o|start|restart|reload-or-restart)$/ } @actions) ; |
14 |
|
|
+ # stop the service if it is disabled |
15 |
jpp |
1.2 |
+ @actions = ('stop') unless $enabled; |
16 |
jpp |
1.1 |
foreach (@actions) |
17 |
|
|
{ |
18 |
|
|
warn "adjusting non-supervised $service ($_)\n"; |
19 |
|
|
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 |
20 |
|
|
--- e-smith-lib-2.6.0.old/root/usr/share/perl5/vendor_perl/esmith/util.pm 2021-01-01 17:54:05.636000000 -0500 |
21 |
|
|
+++ e-smith-lib-2.6.0/root/usr/share/perl5/vendor_perl/esmith/util.pm 2021-01-01 18:14:35.366000000 -0500 |
22 |
|
|
@@ -1119,7 +1119,7 @@ |
23 |
|
|
die "serviceControl: ACTION must be specified"; |
24 |
|
|
} |
25 |
|
|
|
26 |
|
|
- if ( $serviceAction =~ /^(start|stop|restart|reload|graceful|adjust|svdisable|reload-or-restart|try-restart|try-reload-or-restart|enable -now|sigterm|sighup|sigusr1|sigusr2)$/ ) |
27 |
|
|
+ if ( $serviceAction =~ /^(start|stop|restart|reload|graceful|adjust|svdisable|reload-or-restart|try-restart|reload-or-try-restart|enable -now|enable|disable|sig[A-Za-z12]+)$/ ) |
28 |
|
|
{ |
29 |
|
|
my ($startScript) = glob("/etc/rc.d/rc7.d/S*$serviceName") ||'' ; |
30 |
|
|
my ($systemdScript) = "/usr/lib/systemd/system/$serviceName.service" ||''; |
31 |
|
|
@@ -1133,9 +1133,14 @@ |
32 |
|
|
|
33 |
|
|
if (-e $systemdScript and ! -e $startScript){ |
34 |
|
|
# systemd is not aware of adjust, sigusr1, sigusr2, sigterm, sighup |
35 |
|
|
- $serviceAction = ( $serviceAction =~/^(adjust|graceful|sighup|sigusr1|sigusr2)$/ ) ? "reload" : $serviceAction; |
36 |
|
|
- $serviceAction = ( $serviceAction eq "sigterm" ) ? "restart" : $serviceAction; |
37 |
|
|
- if ($serviceAction =~/^(start|stop|restart|reload|reload-or-restart|try-restart|try-reload-or-restart|enable -now)$/) { |
38 |
|
|
+ $serviceAction = ( $serviceAction =~/^(adjust|graceful)$/ ) ? "reload" : $serviceAction; |
39 |
|
|
+ if ($serviceAction =~/^(sig[A-Za-z12]+)$/) { |
40 |
|
|
+ $serviceAction=uc($serviceAction); |
41 |
|
|
+ system('/usr/bin/systemctl',"kill","--signal=$serviceAction","$serviceName.service") == '0' |
42 |
|
|
+ || warn "serviceControl: Couldn't " . |
43 |
|
|
+ "system( /usr/bin/systemctl kill --signal=$serviceAction $serviceName.service): $!\n"; |
44 |
|
|
+ } |
45 |
|
|
+ elsif ($serviceAction =~/^(start|stop|restart|reload|reload-or-restart|try-restart|reload-or-try-restart|enable -now|enable|disable)$/) { |
46 |
|
|
system('/usr/bin/systemctl',"$serviceAction","$serviceName.service") == '0' |
47 |
|
|
|| warn "serviceControl: Couldn't " . |
48 |
|
|
"system( /usr/bin/systemctl $serviceAction $serviceName.service): $!\n"; |
49 |
|
|
@@ -1148,7 +1153,7 @@ |
50 |
|
|
elsif (-e $startScript) { |
51 |
|
|
my $background = $params{'BACKGROUND'} || 'false'; |
52 |
|
|
|
53 |
|
|
- die "serviceControl: Unknown serviceAction $serviceAction" if ($serviceAction =~/^(reload-or-restart|try-restart|try-reload-or-restart|enable -now)$/); |
54 |
|
|
+ die "serviceControl: Unknown serviceAction $serviceAction" if ($serviceAction =~/^(reload-or-restart|try-restart|reload-or-try-restart|enable -now|enable|disable)$/); |
55 |
|
|
if ( $background eq 'true' ) |
56 |
|
|
{ |
57 |
|
|
backgroundCommand( 0, $startScript, $serviceAction ); |