don't background the editor if we are not under X
[sgn-devtools.git] / person_activity.pl
blob5e6d802f92568e32394cc96f167126c717b2dc88
1 #!/usr/bin/perl
3 eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
4 if 0; # not running under some shell
6 use strict;
7 use warnings;
9 use English;
10 use Carp;
11 use FindBin;
13 use Getopt::Std;
14 use Pod::Usage;
16 use List::MoreUtils qw/ uniq /;
18 #use Data::Dumper;
20 our %opt;
21 getopts('',\%opt) or pod2usage(1);
23 my @servers = sort uniq map "$_.sgn.cornell.edu",
24 qw(
25 rubisco
26 pipelines
28 tomatine
29 sgn-vm
30 solanine
31 eggplant
34 for my $server (@servers) {
35 if( open my $w, "ssh $server w |" ) {
36 my $uptime = scalar <$w>;
37 my $header = scalar <$w>;
39 my @recs = map {
40 my ($user, $tty, $from, $logintime, $idle, $jcpu, $pcpu, $what ) = split;
41 unless( $idle =~ /days/ ) {
42 chomp $what;
44 } else {
47 } <$w>;
49 next unless @recs;
50 print "========== $server ==========\n";
51 print $uptime,$header,@recs;
53 } else {
54 warn "could not connect to $server\n";
59 __END__
61 =head1 NAME
63 person_activity.pl - ssh to a bunch of sgn servers and see what everybody is doing
65 =head1 SYNOPSIS
67 person_activity.pl
69 Options:
71 none yet
73 =head1 MAINTAINER
75 Robert Buels
77 =head1 AUTHOR(S)
79 Robert Buels, E<lt>rmb32@cornell.eduE<gt>
81 =head1 COPYRIGHT & LICENSE
83 Copyright 2009 The Boyce Thompson Institute for Plant Research
85 This program is free software; you can redistribute it and/or modify
86 it under the same terms as Perl itself.
88 =cut