line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# (c) Jan Gehring |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Rex::Cron; |
6
|
|
|
|
|
|
|
|
7
|
32
|
|
|
32
|
|
419
|
use v5.12.5; |
|
32
|
|
|
|
|
124
|
|
8
|
32
|
|
|
32
|
|
180
|
use warnings; |
|
32
|
|
|
|
|
48
|
|
|
32
|
|
|
|
|
1493
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.14.2.2'; # TRIAL VERSION |
11
|
|
|
|
|
|
|
|
12
|
32
|
|
|
32
|
|
386
|
use Rex::Commands::Gather; |
|
32
|
|
|
|
|
79
|
|
|
32
|
|
|
|
|
221
|
|
13
|
32
|
|
|
32
|
|
226
|
use List::Util qw'first'; |
|
32
|
|
|
|
|
68
|
|
|
32
|
|
|
|
|
9792
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub create { |
16
|
0
|
|
|
0
|
0
|
|
my ($class) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $type = "Linux"; |
19
|
0
|
0
|
|
|
|
|
if ( operating_system_is("SunOS") ) { |
20
|
0
|
|
|
|
|
|
$type = "SunOS"; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
my $exec = Rex::Interface::Exec->create; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# here we're using first and not any, because in older perl versions |
26
|
|
|
|
|
|
|
# there is no any() function in List::Util. |
27
|
0
|
0
|
0
|
|
|
|
if ( operating_system_is( "FreeBSD", "OpenBSD", "NetBSD" ) |
28
|
0
|
|
|
0
|
|
|
&& first { $exec->shell->name eq $_ } (qw/csh ksh tcsh/) ) |
29
|
|
|
|
|
|
|
{ |
30
|
0
|
|
|
|
|
|
$type = "FreeBSD"; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $klass = "Rex::Cron::$type"; |
34
|
0
|
|
|
|
|
|
eval "use $klass;"; |
35
|
0
|
0
|
|
|
|
|
if ($@) { |
36
|
0
|
|
|
|
|
|
die("Error creating cron class: $klass\n$@"); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
return $klass->new; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |