line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id$ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# system::centos::service Brik |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
package Metabrik::System::Centos::Service; |
7
|
1
|
|
|
1
|
|
707
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use base qw(Metabrik::Shell::Command); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
311
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub brik_properties { |
13
|
|
|
|
|
|
|
return { |
14
|
0
|
|
|
0
|
1
|
|
revision => '$Revision$', |
15
|
|
|
|
|
|
|
tags => [ qw(unstable) ], |
16
|
|
|
|
|
|
|
author => 'GomoR ', |
17
|
|
|
|
|
|
|
license => 'http://opensource.org/licenses/BSD-3-Clause', |
18
|
|
|
|
|
|
|
attributes => { |
19
|
|
|
|
|
|
|
}, |
20
|
|
|
|
|
|
|
attributes_default => { |
21
|
|
|
|
|
|
|
}, |
22
|
|
|
|
|
|
|
commands => { |
23
|
|
|
|
|
|
|
enable => [ qw(service_name) ], |
24
|
|
|
|
|
|
|
disable => [ qw(service_name) ], |
25
|
|
|
|
|
|
|
}, |
26
|
|
|
|
|
|
|
require_binaries => { |
27
|
|
|
|
|
|
|
systemctl => [ ], |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
need_packages => { |
30
|
|
|
|
|
|
|
centos => [ qw(systemd) ], |
31
|
|
|
|
|
|
|
}, |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub enable { |
36
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
37
|
0
|
|
|
|
|
|
my ($service_name) = @_; |
38
|
|
|
|
|
|
|
|
39
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('enable', $service_name) or return; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
my $cmd = "systemctl enable \"$service_name\""; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
return $self->sudo_execute($cmd); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub disable { |
47
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
48
|
0
|
|
|
|
|
|
my ($service_name) = @_; |
49
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('disable', $service_name) or return; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $cmd = "systemctl disable \"$service_name\""; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
return $self->sudo_execute($cmd); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |