/[smeserver]/rpms/e-smith-lib/sme10/e-smith-lib-2.6.0.bz9660.serviceControlSystemd.patch
ViewVC logotype

Contents of /rpms/e-smith-lib/sme10/e-smith-lib-2.6.0.bz9660.serviceControlSystemd.patch

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


Revision 1.1 - (show annotations) (download)
Thu Jul 14 21:11:13 2016 UTC (8 years, 3 months ago) by stephdl
Branch: MAIN
CVS Tags: e-smith-lib-2_6_0-5_el7_sme, e-smith-lib-2_6_0-7_el7_sme, e-smith-lib-2_6_0-6_el7_sme, e-smith-lib-2_6_0-15_el7_sme, e-smith-lib-2_6_0-2_el7_sme, e-smith-lib-2_6_0-4_el7_sme, e-smith-lib-2_6_0-13_el7_sme, e-smith-lib-2_6_0-16_el7_sme, e-smith-lib-2_6_0-10_el7_sme, e-smith-lib-2_6_0-17_el7_sme, e-smith-lib-2_6_0-11_el7_sme, e-smith-lib-2_6_0-14_el7_sme, e-smith-lib-2_6_0-8_el7_sme, e-smith-lib-2_6_0-3_el7_sme, e-smith-lib-2_6_0-9_el7_sme, e-smith-lib-2_6_0-12_el7_sme, HEAD
* Thu Jul 14 2016 stephane de Labrusse <stephdl@de-labrusse.fr> 2.6.0-2.sme
- fix esmith::util::serviceControl to manage systemd service [SME: 9660]
- Added e-smith-lib-2.6.0.bz9660.serviceControlSystemd.patch

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

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