-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathperson_activity.pl
More file actions
executable file
·88 lines (60 loc) · 1.38 KB
/
Copy pathperson_activity.pl
File metadata and controls
executable file
·88 lines (60 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/perl
eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
if 0; # not running under some shell
use strict;
use warnings;
use English;
use Carp;
use FindBin;
use Getopt::Std;
use Pod::Usage;
use List::MoreUtils qw/ uniq /;
#use Data::Dumper;
our %opt;
getopts('',\%opt) or pod2usage(1);
my @servers = sort uniq map "$_.sgn.cornell.edu",
qw(
rubisco
pipelines
db
tomatine
sgn-vm
solanine
eggplant
);
for my $server (@servers) {
if( open my $w, "ssh $server w |" ) {
my $uptime = scalar <$w>;
my $header = scalar <$w>;
my @recs = map {
my ($user, $tty, $from, $logintime, $idle, $jcpu, $pcpu, $what ) = split;
unless( $idle =~ /days/ ) {
chomp $what;
$_
} else {
()
}
} <$w>;
next unless @recs;
print "========== $server ==========\n";
print $uptime,$header,@recs;
} else {
warn "could not connect to $server\n";
}
}
__END__
=head1 NAME
person_activity.pl - ssh to a bunch of sgn servers and see what everybody is doing
=head1 SYNOPSIS
person_activity.pl
Options:
none yet
=head1 MAINTAINER
Robert Buels
=head1 AUTHOR(S)
Robert Buels, E<lt>rmb32@cornell.eduE<gt>
=head1 COPYRIGHT & LICENSE
Copyright 2009 The Boyce Thompson Institute for Plant Research
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut