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) |
+ # 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) ; |
+ 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 |
+ # stop the service if it is disabled |
15 |
+ @actions = ('stop'); |
+ @actions = ('stop') unless $enabled; |
16 |
foreach (@actions) |
foreach (@actions) |
17 |
{ |
{ |
18 |
warn "adjusting non-supervised $service ($_)\n"; |
warn "adjusting non-supervised $service ($_)\n"; |
28 |
{ |
{ |
29 |
my ($startScript) = glob("/etc/rc.d/rc7.d/S*$serviceName") ||'' ; |
my ($startScript) = glob("/etc/rc.d/rc7.d/S*$serviceName") ||'' ; |
30 |
my ($systemdScript) = "/usr/lib/systemd/system/$serviceName.service" ||''; |
my ($systemdScript) = "/usr/lib/systemd/system/$serviceName.service" ||''; |
31 |
@@ -1133,9 +1133,14 @@ |
@@ -1133,9 +1133,15 @@ |
32 |
|
|
33 |
if (-e $systemdScript and ! -e $startScript){ |
if (-e $systemdScript and ! -e $startScript){ |
34 |
# systemd is not aware of adjust, sigusr1, sigusr2, sigterm, sighup |
# systemd is not aware of adjust, sigusr1, sigusr2, sigterm, sighup |
35 |
- $serviceAction = ( $serviceAction =~/^(adjust|graceful|sighup|sigusr1|sigusr2)$/ ) ? "reload" : $serviceAction; |
- $serviceAction = ( $serviceAction =~/^(adjust|graceful|sighup|sigusr1|sigusr2)$/ ) ? "reload" : $serviceAction; |
36 |
- $serviceAction = ( $serviceAction eq "sigterm" ) ? "restart" : $serviceAction; |
- $serviceAction = ( $serviceAction eq "sigterm" ) ? "restart" : $serviceAction; |
37 |
- if ($serviceAction =~/^(start|stop|restart|reload|reload-or-restart|try-restart|try-reload-or-restart|enable -now)$/) { |
- if ($serviceAction =~/^(start|stop|restart|reload|reload-or-restart|try-restart|try-reload-or-restart|enable -now)$/) { |
38 |
+ $serviceAction = ( $serviceAction =~/^(adjust|graceful)$/ ) ? "reload" : $serviceAction; |
+ $serviceAction = ( $serviceAction =~/^(adjust|graceful|sighup|sigusr1|sigusr2)$/ ) ? "reload-or-restart" : $serviceAction; |
39 |
|
+ $serviceAction = ( $serviceAction eq "sigterm" ) ? "restart" : $serviceAction; |
40 |
+ if ($serviceAction =~/^(sig[A-Za-z12]+)$/) { |
+ if ($serviceAction =~/^(sig[A-Za-z12]+)$/) { |
41 |
+ $serviceAction=uc($serviceAction); |
+ $serviceAction=uc($serviceAction); |
42 |
+ system('/usr/bin/systemctl',"kill","--signal=$serviceAction","$serviceName.service") == '0' |
+ system('/usr/bin/systemctl',"kill","--signal=$serviceAction","$serviceName.service") == '0' |