App-Regather
view release on metacpan or search on metacpan
lib/App/Regather.pm view on Meta::CPAN
93949596979899100101102103104105106107108109110111112113
pod2usage(
-exitval
=> 2,
-sections
=> [
qw(USAGE)
]);
exit
1;
}
$self
->{_opt}{cf} = new
App::Regather::Config (
filename
=>
$self
->{_opt}{config},
logger
=>
$self
->{_opt}{l},
cli
=>
$self
->{_opt}{cli},
verbose
=>
$self
->{_opt}{v} );
my
$cf_mode
= (
stat
(
$self
->{_opt}{config}))[2] & 0777;
my
$fm_msg
;
if
(
$cf_mode
& 002 ||
$cf_mode
& 006 ) {
$fm_msg
=
'world'
;
}
elsif
(
$cf_mode
& 020 ||
$cf_mode
& 060) {
$fm_msg
=
'group'
;
}
if
(
defined
$fm_msg
) {
$self
->{_opt}{l}->cc(
pr
=>
'err'
,
fm
=>
'config file is accessible by '
.
$fm_msg
);
$self
->{_opt}{l}->cc(
fg
=> 1,
pr
=>
'err'
,
fm
=>
'config file is accessible by '
.
$fm_msg
);
pod2usage(
-exitval
=> 2,
-sections
=> [
qw(USAGE)
]);
lib/App/Regather.pm view on Meta::CPAN
338339340341342343344345346347348349350351352353354355356357close
(
$fh
) ||
do
{
"close $self->cf->get(qw(core pid_file)) (opened for reading) failed: $!\n\n"
;
exit
1;
};
if
(
kill
(0,
$pid
) ) {
"Doing nothing\npidfile $self->cf->get(qw(core pid_file)) of the proces with pid $pid, exists and the very process is alive\n\n"
;
exit
1;
}
$orphaned_pid_mtime
= strftime(
$self
->o(
'ts_fmt'
),
localtime
( (
stat
(
$self
->cf->get(
qw(core pid_file)
) ))[9] ));
if
(
unlink
$self
->cf->get(
qw(core pid_file)
) ) {
$self
->l->cc(
pr
=>
'debug'
,
fm
=>
"%s:%s: orphaned %s was removed"
,
ls
=> [ __FILE__,__LINE__,
$self
->cf->get(
qw(core pid_file)
) ] )
if
$self
->o(
'v'
) > 0;
}
else
{
$self
->l->cc(
pr
=>
'err'
,
fm
=>
"%s:%s: orphaned %s (mtime: %s) was not removed: %s"
,
ls
=> [ __FILE__,__LINE__,
$self
->cf->get(
qw(core pid_file)
),
$orphaned_pid_mtime
, $! ] );
exit
2;
}
lib/App/Regather/Plugin/configfile.pm view on Meta::CPAN
160161162163164165166167168169170171172173174175176177178179180181182183184185186
(
split
(/=/, (
split
(/,/,
$self
->obj->get_value(
'creatorsName'
)) )[0]) )[1] :
'UNKNOWN'
;
$tt_vars
->{modifiedby} =
$self
->obj->
exists
(
'modifiersName'
) ?
(
split
(/=/, (
split
(/,/,
$self
->obj->get_value(
'modifiersName'
)) )[0]) )[1] :
'UNKNOWN'
;
if
( !
$self
->force && -e
$out_to
&&
( generalizedTime_to_time(
$self
->obj->get_value(
'modifyTimestamp'
))
<
(
stat
(
$out_to
))[9] ) ) {
$self
->
log
->cc(
pr
=>
'debug'
,
fm
=>
"%s: skip. object %s is older than target file %s, (object modifyTimestamp: %s is older than file mtime: %s"
,
ls
=> [
sprintf
(
"%s:%s"
,__FILE__,__LINE__),
$self
->obj->dn,
$out_to
,
strftime(
"%F %T"
,
localtime
(generalizedTime_to_time(
$self
->obj->get_value(
'modifyTimestamp'
)))),
strftime(
"%F %T"
,
localtime
((
stat
(
$out_to
))[9])),
] )
if
$self
->{v} > 0;
return
;
}
### PICKING ROOT OBJECT RDN (IN OUR CASE IT IS "UID")
foreach
(
reverse
split
(/,/,
$self
->obj->dn) ) {
next
if
$_
!~ /^uid=/;
$tt_vars
->{uid} = (
split
(/=/,
$_
) )[1];
last
;
( run in 1.103 second using v1.01-cache-2.11-cpan-49f99fa48dc )