}
sub do_hosts {
- my (@check) = ("tobias", "lucille", "lindsay", "buster");
+ my (@check) = ("tobias", "lindsay");
my (@uphosts, @livehosts, $host, $hostlist);
if(($_[0] || 0) == 1) {
$hostlist=$state{'hosts'};
eval {
local $SIG{ALRM} = sub { die "alarm\n" };
alarm(30);
- $ret=!(system(@ssh,shift, 'if pidof xscreensaver >/dev/null && DISPLAY=:0.0 xscreensaver-command -version >/dev/null 2>&1; then if DISPLAY=:0.0 xscreensaver-command -time 2>&1 |egrep "non-blanked|no saver status" >/dev/null; then true; else pid=`ps ax|egrep "[0-9]:[0-9][0-9] ssh gob .*(screen.*RR irc|Chat)"|sed -e "s/^ *//"|cut -d" " -f 1`; [ -f "$HOME/.irc.lock" -o -z "$pid" ] || kill $pid; false; fi; else false; fi') >> 8);
+ $ret=!(system(@ssh,shift, 'if pidof xscreensaver >/dev/null && DISPLAY=:0.0 xscreensaver-command -version >/dev/null 2>&1; then if DISPLAY=:0.0 xscreensaver-command -time 2>&1 |egrep "non-blanked|no saver status" >/dev/null; then true; else pid=`ps ax|egrep "[0-9]:[0-9][0-9] ssh michael .*(screen.*RR irc|Chat)"|sed -e "s/^ *//"|cut -d" " -f 1`; [ -f "$HOME/.irc.lock" -o -z "$pid" ] || kill $pid; false; fi; else false; fi') >> 8);
alarm(0);
};
if($@) {
if(!ping('tobias')) {
$phone="unknown";
} else {
- my $last_slh=`@ssh tobias cat .blue/last_slh 2>/dev/null`;
+ my $last_slh=`@ssh tobias cat .blue/last_slh .blue/last_gm 2>/dev/null`;
if(!$last_slh) {
$phone="unknown";
- } elsif (time-$last_slh < 540) {
+ } elsif (time-$last_slh < 1140) {
$phone="present";
} else {
$phone="absent";
}
sub do_power {
- open TMP, "upsc milhouse\@localhost 2>/dev/null|";
+ open TMP, "upsc sally\@localhost 2>/dev/null|";
my $ups='';
while(<TMP>) {
chomp;
sub save {
if (defined($state{'activity'})) {
- $state{'status'}=$state{'activity'};
+ $state{'status'}=$state{'activity'};
} elsif (defined($state{'away'})) {
- $state{'status'}=$state{'away'};
- } elsif ($state{'alive'} eq "tobias" || $state{'alive'} eq "lucille") {
- $state{'status'}="On desktop";
+ $state{'status'}=$state{'away'};
+ } elsif ($state{'alive'} eq "tobias") {
+ $state{'status'}="On desktop";
} elsif ($state{'alive'} eq "lindsay") {
- $state{'status'}="On laptop";
- } elsif ($state{'alive'} eq "buster") {
- $state{'status'}="In bed";
+ $state{'status'}="On laptop";
+ #} elsif ($state{'alive'} eq "buster") {
+ #$state{'status'}="In bed";
}
open CONF, '>' . $ENV{'HOME'} . "/.away-tpope" || die $!;
foreach my $k (keys %state) {
- my $val=$state{$k};
- next unless($val);
- $val =~ s/\n/\\n/g;
- $val =~ s/"/\\"/g;
- print CONF "$k=\"$val\"\n";
+ my $val=$state{$k};
+ next unless($val);
+ $val =~ s/\n/\\n/g;
+ $val =~ s/"/\\"/g;
+ print CONF "$k=\"$val\"\n";
}
close CONF;
if(defined($state{'activity'})) {
- open TMP, '>' . $ENV{'HOME'} . "/.activity";
- print TMP $state{'activity'}."\n";
- close TMP;
+ open TMP, '>' . $ENV{'HOME'} . "/.activity";
+ print TMP $state{'activity'}."\n";
+ close TMP;
} else {
- unlink($ENV{'HOME'} . "/.activity");
+ unlink($ENV{'HOME'} . "/.activity");
}
if(defined($state{'away'})) {
- open TMP, '>' . $ENV{'HOME'} . "/.away";
- print TMP $state{'away'}."\n";
- close TMP;
+ open TMP, '>' . $ENV{'HOME'} . "/.away";
+ print TMP $state{'away'}."\n";
+ close TMP;
} else {
- unlink($ENV{'HOME'} . "/.away");
+ unlink($ENV{'HOME'} . "/.away");
}
open TMP, '>' . $ENV{'HOME'} . "/.status";
print TMP $state{'status'}."\n";
undef $state{'customout'};
undef $state{'internalout'};
while(my $line=<CONF>) {
- $line =~ s/\\n/\n/g;
- $line =~ s/\\"/"/g;
- $line =~ s/"$//;
- $line =~ s/^([^=]*)="?//;
- chomp $line;
- $state{$1}=$line;
+ $line =~ s/\\n/\n/g;
+ $line =~ s/\\"/"/g;
+ $line =~ s/"$//;
+ $line =~ s/^([^=]*)="?//;
+ chomp $line;
+ $state{$1}=$line;
}
close CONF;
}