File Coverage

blib/lib/XAS/Apps/Init.pm
Criterion Covered Total %
statement 3 12 25.0
branch 0 2 0.0
condition n/a
subroutine 1 2 50.0
pod 1 1 100.0
total 5 17 29.4


line stmt bran cond sub pod time code
1             package XAS::Apps::Init ;
2              
3             our $VERSION = '0.01';
4              
5             use XAS::Class
6 1         4 debug => 0,
7             version => $VERSION,
8             base => 'XAS::Lib::App',
9 1     1   744 ;
  1         2  
10              
11             # ----------------------------------------------------------------------
12             # Public Methods
13             # ----------------------------------------------------------------------
14              
15             sub main {
16 0     0 1   my $self = shift;
17              
18 0           my @dirs = ('/var/run/xas', '/var/lock/xas');
19 0           my ($login,$pass,$uid,$gid) = getpwnam('xas');
20              
21 0           foreach my $dir (@dirs) {
22              
23 0 0         unless ( -e $dir ) {
24              
25 0           mkdir $dir;
26 0           chown $uid, $gid, $dir;
27 0           chmod 0775, $dir;
28 0           system("chmod g+s $dir");
29              
30             }
31              
32             }
33              
34             }
35              
36             # ----------------------------------------------------------------------
37             # Private Methods
38             # ----------------------------------------------------------------------
39              
40             1;
41              
42             __END__
43              
44             =head1 NAME
45              
46             XAS::Apps::Init - A class for the XAS environment
47              
48             =head1 SYNOPSIS
49              
50             use XAS::Apps::Init ;
51              
52             my $app = XAS::Apps::Init->new(
53             -throws => 'xas-init',
54             -priority => 'low',
55             -facility => 'system',
56             );
57              
58             exit $app->run;
59              
60             =head1 DESCRIPTION
61              
62             The procedure will check and create /var/run/xas and /var/lock/xas. This
63             is needed on systemd systems. On systemd systems, these directories are
64             mounted on filesystems the use tmpfs. So a system reboot removes them.
65              
66             =head1 METHODS
67              
68             =head2 main
69              
70             This method will start the processing.
71              
72             =head1 SEE ALSO
73              
74             =over 4
75              
76             =item L<XAS|XAS>
77              
78             =back
79              
80             =head1 AUTHOR
81              
82             Kevin L. Esteb, E<lt>kevin@kesteb.usE<gt>
83              
84             =head1 COPYRIGHT AND LICENSE
85              
86             Copyright (c) 2012-2017 Kevin L. Esteb
87              
88             This is free software; you can redistribute it and/or modify it under
89             the terms of the Artistic License 2.0. For details, see the full text
90             of the license at http://www.perlfoundation.org/artistic_license_2_0.
91              
92             =cut