projects
/
clearscm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Removed debug statements
[clearscm.git]
/
bin
/
cleantmp.pl
diff --git
a/bin/cleantmp.pl
b/bin/cleantmp.pl
index
79c567a
..
4b42cbe
100755
(executable)
--- a/
bin/cleantmp.pl
+++ b/
bin/cleantmp.pl
@@
-46,6
+46,8
@@
$Date: $
-c|onf <file>: Config file holding patterns to match (Default:
.../etc/cleantmp.conf)
-l|ogpath <path>: Path to logfile (Default: /var/log)
-c|onf <file>: Config file holding patterns to match (Default:
.../etc/cleantmp.conf)
-l|ogpath <path>: Path to logfile (Default: /var/log)
+ -a|ppend: Append to logfile (Default: Noappend)
+ -da|emon Run in daemon mode (Default: -daemon)
-s|leep <secs>: How many seconds to sleep between polls (Default: 60)
=head1 DESCRIPTION
-s|leep <secs>: How many seconds to sleep between polls (Default: 60)
=head1 DESCRIPTION
@@
-80,9
+82,10
@@
my %opts = (
help => sub { pod2usage(-verbose => 2)},
verbose => sub { set_verbose },
debug => sub { set_debug },
help => sub { pod2usage(-verbose => 2)},
verbose => sub { set_verbose },
debug => sub { set_debug },
+ daemon => 1,
tmp => File::Spec->tmpdir(),
conf => "$FindBin::Bin/../etc/$script.conf",
tmp => File::Spec->tmpdir(),
conf => "$FindBin::Bin/../etc/$script.conf",
- logpath => '/var/log',
+ logpath => '/var/lo
cal/lo
g',
sleep => 60,
);
sleep => 60,
);
@@
-144,7
+147,6
@@
sub FileCreated {
} # if
} # if
} # if
} # if
-
last;
} # if
} # for
last;
} # if
} # for
@@
-153,6
+155,8
@@
sub FileCreated {
return;
} # FileCreated
return;
} # FileCreated
+$SIG{USR1} = \&FileCreated;
+
## Main
GetOptions (
\%opts,
## Main
GetOptions (
\%opts,
@@
-160,13
+164,19
@@
GetOptions (
'help',
'verbose',
'debug',
'help',
'verbose',
'debug',
+ 'daemon!',
'tmp=s',
'logpath=s',
'conf=s',
'tmp=s',
'logpath=s',
'conf=s',
- 'sleep=i'
+ 'sleep=i',
+ 'append',
) or pod2usage;
) or pod2usage;
-$log = Logger->new(path => $opts{logpath}, timestamped => 1);
+$log = Logger->new(
+ path => $opts{logpath},
+ timestamped => 1,
+ append => $opts{append},
+);
$log->msg("Starting $FindBin::Script");
$log->msg("Starting $FindBin::Script");
@@
-185,7
+195,12
@@
$monitor->watch({
set_debug if $DB::OUT;
set_debug if $DB::OUT;
-EnterDaemonMode unless $DB::OUT or get_debug;
+if ($opts{daemon}) {
+ # Perl complains if we reference $DB::OUT only once
+ no warnings;
+ EnterDaemonMode unless defined $DB::OUT or get_debug;
+ use warnings;
+} # if
while () {
$monitor->scan;
while () {
$monitor->scan;