line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# (c) Jan Gehring |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Rex::Service::SunOS; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
13
|
use v5.12.5; |
|
1
|
|
|
|
|
4
|
|
8
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
57
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.14.2.3'; # TRIAL VERSION |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
7
|
use Rex::Helper::Run; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
66
|
|
13
|
1
|
|
|
1
|
|
7
|
use Rex::Logger; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
14
|
1
|
|
|
1
|
|
21
|
use Rex::Commands::Fs; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
7
|
use base qw(Rex::Service::Base); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
454
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
0
|
|
|
0
|
0
|
|
my $that = shift; |
20
|
0
|
|
0
|
|
|
|
my $proto = ref($that) || $that; |
21
|
0
|
|
|
|
|
|
my $self = $proto->SUPER::new(@_); |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
bless( $self, $proto ); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$self->{commands} = { |
26
|
0
|
|
|
|
|
|
start => '/etc/init.d/%s start', |
27
|
|
|
|
|
|
|
restart => '/etc/init.d/%s restart', |
28
|
|
|
|
|
|
|
stop => '/etc/init.d/%s stop', |
29
|
|
|
|
|
|
|
reload => '/etc/init.d/%s reload', |
30
|
|
|
|
|
|
|
status => '/etc/init.d/%s status', |
31
|
|
|
|
|
|
|
action => '/etc/init.d/%s %s', |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
return $self; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub ensure { |
38
|
0
|
|
|
0
|
0
|
|
my ( $self, $service, $options ) = @_; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $what = $options->{ensure}; |
41
|
|
|
|
|
|
|
|
42
|
0
|
0
|
0
|
|
|
|
if ( $what =~ /^stop/ ) { |
|
|
0
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
$self->stop( $service, $options ); |
44
|
0
|
|
|
|
|
|
eval { i_run "rm /etc/rc*.d/S*$service"; }; |
|
0
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
elsif ( $what =~ /^start/ || $what =~ m/^run/ ) { |
47
|
0
|
|
|
|
|
|
$self->start( $service, $options ); |
48
|
0
|
|
|
|
|
|
my ($runlevel) = map { /run-level (\d)/ } i_run "who -r"; |
|
0
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
ln "/etc/init.d/$service", "/etc/rc${runlevel}.d/S99$service"; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
return 1; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |