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 |
jpp |
1.3 |
@@ -1133,9 +1133,15 @@ |
32 |
jpp |
1.1 |
|
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 |
jpp |
1.3 |
+ $serviceAction = ( $serviceAction =~/^(adjust|graceful|sighup|sigusr1|sigusr2)$/ ) ? "reload-or-restart" : $serviceAction; |
39 |
|
|
+ $serviceAction = ( $serviceAction eq "sigterm" ) ? "restart" : $serviceAction; |
40 |
jpp |
1.1 |
+ if ($serviceAction =~/^(sig[A-Za-z12]+)$/) { |
41 |
|
|
+ $serviceAction=uc($serviceAction); |
42 |
|
|
+ system('/usr/bin/systemctl',"kill","--signal=$serviceAction","$serviceName.service") == '0' |
43 |
|
|
+ || warn "serviceControl: Couldn't " . |
44 |
|
|
+ "system( /usr/bin/systemctl kill --signal=$serviceAction $serviceName.service): $!\n"; |
45 |
|
|
+ } |
46 |
|
|
+ elsif ($serviceAction =~/^(start|stop|restart|reload|reload-or-restart|try-restart|reload-or-try-restart|enable -now|enable|disable)$/) { |
47 |
|
|
system('/usr/bin/systemctl',"$serviceAction","$serviceName.service") == '0' |
48 |
|
|
|| warn "serviceControl: Couldn't " . |
49 |
|
|
"system( /usr/bin/systemctl $serviceAction $serviceName.service): $!\n"; |
50 |
|
|
@@ -1148,7 +1153,7 @@ |
51 |
|
|
elsif (-e $startScript) { |
52 |
|
|
my $background = $params{'BACKGROUND'} || 'false'; |
53 |
|
|
|
54 |
|
|
- die "serviceControl: Unknown serviceAction $serviceAction" if ($serviceAction =~/^(reload-or-restart|try-restart|try-reload-or-restart|enable -now)$/); |
55 |
|
|
+ die "serviceControl: Unknown serviceAction $serviceAction" if ($serviceAction =~/^(reload-or-restart|try-restart|reload-or-try-restart|enable -now|enable|disable)$/); |
56 |
|
|
if ( $background eq 'true' ) |
57 |
|
|
{ |
58 |
|
|
backgroundCommand( 0, $startScript, $serviceAction ); |