projects
/
BackupPC.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
40df441
)
show status in ps output by modifing $0
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Thu, 27 Jan 2011 21:29:43 +0000
(22:29 +0100)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Thu, 27 Jan 2011 21:29:43 +0000
(22:29 +0100)
bin/BackupPC_ASA_SearchUpdate
patch
|
blob
|
history
diff --git
a/bin/BackupPC_ASA_SearchUpdate
b/bin/BackupPC_ASA_SearchUpdate
index
2ce01fc
..
5615abb
100755
(executable)
--- a/
bin/BackupPC_ASA_SearchUpdate
+++ b/
bin/BackupPC_ASA_SearchUpdate
@@
-78,6
+78,19
@@
warn "hosts: ",dump( $opt->host );
#---- subs ----
#---- subs ----
+sub status {
+ my $text = shift;
+ $text =~ s{\s+$}{};
+ my $new = $0;
+ $new =~ s{^[\w\/]+/(\w+) }{$1 }; # strip path from process name
+ if ( $text =~ m/^\|/ ) {
+ $new =~ s/\|.*/$text/ or $new .= " $text";
+ } else {
+ $new =~ s/\s+.*/ $text/ or $new .= " $text";
+ }
+ $0 = $new;
+}
+
sub fmt_time {
my $t = shift || return;
my $out = "";
sub fmt_time {
my $t = shift || return;
my $out = "";
@@
-170,6
+183,7
@@
sub hest_update {
}
print "$added";
}
print "$added";
+ status "| $added";
$offset += EST_CHUNK;
$offset += EST_CHUNK;
@@
-440,7
+454,7
@@
INSERT INTO hosts (name, IP) VALUES (?,?)
});
$sth->{hosts_by_name} = $dbh->prepare(qq{
});
$sth->{hosts_by_name} = $dbh->prepare(qq{
-SELECT
ID
FROM hosts WHERE name=?
+SELECT
id
FROM hosts WHERE name=?
});
$sth->{backups_count} = $dbh->prepare(qq{
});
$sth->{backups_count} = $dbh->prepare(qq{
@@
-518,6
+532,7
@@
foreach my $host_key (@hosts) {
fmt_time($backup->{endTime} - $backup->{startTime})
);
print $share_header unless $opt->quiet;
fmt_time($backup->{endTime} - $backup->{startTime})
);
print $share_header unless $opt->quiet;
+ status "$hostname $backupNum $share_header";
my $files = BackupPC::View->new($bpc, $hostname, \@backups, { only_first => 1 });
my $files = BackupPC::View->new($bpc, $hostname, \@backups, { only_first => 1 });
@@
-572,14
+587,17
@@
foreach my $host_key (@hosts) {
}
my $dur = (time() - $t) || 1;
}
my $dur = (time() - $t) || 1;
-
printf(" %d/%d files %d/%d dirs %0.2f MB [%.2f/s dur: %s]\n
",
+
my $status = sprintf("%d/%d files %d/%d dirs %0.2f MB [%.2f/s dur: %s]
",
$nf, $f, $nd, $d,
($size / 1024 / 1024),
( ($f+$d) / $dur ),
fmt_time($dur)
);
$nf, $f, $nd, $d,
($size / 1024 / 1024),
( ($f+$d) / $dur ),
fmt_time($dur)
);
+ print " $status\n";
+ status "$hostname $backupNum $status";
if ($nf + $nd > 0) {
if ($nf + $nd > 0) {
+ status "$hostname $backupNum full-text | indexing";
eval { hest_update($hostID, $shareID, $backupNum) };
warn "ERROR: $@" if $@;
}
eval { hest_update($hostID, $shareID, $backupNum) };
warn "ERROR: $@" if $@;
}