/[smeserver]/rpms/e-smith-lib/sme10/e-smith-lib-2.6.0-bz11177-systemd.patch
ViewVC logotype

Annotation of /rpms/e-smith-lib/sme10/e-smith-lib-2.6.0-bz11177-systemd.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Tue Nov 17 16:48:08 2020 UTC (3 years, 11 months ago) by jpp
Branch: MAIN
CVS Tags: e-smith-lib-2_6_0-10_el7_sme
* Tue Nov 17 2020 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-10.sme
- allow more systemctl controls [SME: 11177]
  convert unrecognized signals from service2adjust in events for systemd
  handle unsupervised services the same way supervised were in adjust-services
- create e-smith-lib-event [SME: 11141]

* Thu Dec 12 2019 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-9.sme
- add support for systemctl reload-or-restart, try-restart, enable -now  [SME: 10848]

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 2016-02-05 17:44:16.000000000 -0500
3     +++ e-smith-lib-2.6.0/root/etc/e-smith/events/actions/adjust-services 2020-11-16 01:15:19.192000000 -0500
4     @@ -111,7 +111,8 @@
5     }
6     }
7    
8     - if (-d "/service/$service")
9     + # if service is supervised and not handled by systemd
10     + if (-d "/service/$service" && glob("/etc/rc7.d/S??$service"))
11     {
12     my $enabled = ($s->prop('status') || 'disabled') eq 'enabled';
13     adjust_supervised_service($service,
14     @@ -124,8 +125,14 @@
15     ($enabled && !grep { /^(down|stop|d|once|o)$/ } @actions) ? 'up' : (),
16     );
17     }
18     + # for service handled by former sysvinit or directly with systemd
19     else
20     {
21     + my $enabled = ($s->prop('status') || 'disabled') eq 'enabled';
22     + # stop the service if it is now disabled
23     + unshift(@actions,'stop') unless $enabled;
24     + # bring the service up if it is enabled (and we're not stopping it or running it once)
25     + push(@actions,'start') if ($enabled && !grep { /^(down|stop|d|once|o|start|restart|reload-or-restart)$/ } @actions) ;
26     foreach (@actions)
27     {
28     warn "adjusting non-supervised $service ($_)\n";
29     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
30     --- e-smith-lib-2.6.0.old/root/usr/share/perl5/vendor_perl/esmith/util.pm 2020-11-17 11:06:04.842000000 -0500
31     +++ e-smith-lib-2.6.0/root/usr/share/perl5/vendor_perl/esmith/util.pm 2020-11-16 01:05:33.057000000 -0500
32     @@ -1119,7 +1119,7 @@
33     die "serviceControl: ACTION must be specified";
34     }
35    
36     - if ( $serviceAction =~ /^(start|stop|restart|reload|graceful|adjust|svdisable|reload-or-restart|try-restart|enable -now)$/ )
37     + if ( $serviceAction =~ /^(start|stop|restart|reload|graceful|adjust|svdisable|reload-or-restart|try-restart|try-reload-or-restart|enable -now|sigterm|sighup|sigusr1|sigusr2)$/ )
38     {
39     my ($startScript) = glob("/etc/rc.d/rc7.d/S*$serviceName") ||'' ;
40     my ($systemdScript) = "/usr/lib/systemd/system/$serviceName.service" ||'';
41     @@ -1132,7 +1132,10 @@
42     }
43    
44     if (-e $systemdScript and ! -e $startScript){
45     - if ($serviceAction =~/^(start|stop|restart|reload|reload-or-restart|try-restart|enable -now)$/) {
46     + # systemd is not aware of adjust, sigusr1, sigusr2, sigterm, sighup
47     + $serviceAction = ( $serviceAction =~/^(adjust|graceful|sighup|sigusr1|sigusr2)$/ ) ? "reload" : $serviceAction;
48     + $serviceAction = ( $serviceAction eq "sigterm" ) ? "restart" : $serviceAction;
49     + if ($serviceAction =~/^(start|stop|restart|reload|reload-or-restart|try-restart|try-reload-or-restart|enable -now)$/) {
50     system('/usr/bin/systemctl',"$serviceAction","$serviceName.service") == '0'
51     || warn "serviceControl: Couldn't " .
52     "system( /usr/bin/systemctl $serviceAction $serviceName.service): $!\n";
53     @@ -1145,7 +1148,7 @@
54     elsif (-e $startScript) {
55     my $background = $params{'BACKGROUND'} || 'false';
56    
57     - die "serviceControl: Unknown serviceAction $serviceAction" if ($serviceAction =~/^(reload-or-restart|try-restart|enable -now)$/);
58     + die "serviceControl: Unknown serviceAction $serviceAction" if ($serviceAction =~/^(reload-or-restart|try-restart|try-reload-or-restart|enable -now|sigterm|sighup|sigusr1|sigusr2)$/);
59     if ( $background eq 'true' )
60     {
61     backgroundCommand( 0, $startScript, $serviceAction );

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed