#!/usr/bin/perl -w # 'setinow' SETI@home status by David Efflandt tech@de-srv.com # last updated 12/26/00 # # Shows path to SETI@home files, current date, SETI version, # last results time and count, % progress with graph, current hours, # estimated remaining & total hours and estimated completion time. # # For info on Search for Extraterrestrial Intelligence at Home see: # http://setiathome.berkeley.edu/ # # I use a ramdisk which is no faster, but saves disk access. # I backup to hard drive every regularly by cron and /etc/ppp/ip-down. use strict; # fix your error or comment out if this is a problem # Don't touch following statement unless adding your own vars: my ($setipath,$path,$rtime,@lines,$cpu,$prog,$graf,$now, $subtotal,$total,$time); ### User Variables ### # Set path to default setiathome dir (uncomment or edit your path) # Easiest if you: ln -s setathome- setiathome $setipath = $ENV{HOME} . '/seti-ram'; # $setipath = $ENV{HOME} . '/setiathome'; # Don't touch this unless names change: my $statefile = 'state.sah'; my $userinfo = 'user_info.sah'; my $version = 'version.sah'; ### End of User Variables ### # Use path entered in command line or default if not $path = shift || $setipath; # Automatically append filename to path if ($path && -d $path) { $path .= '/' unless $path =~ m|/$|; $statefile = $path . $statefile; $userinfo = $path . $userinfo; $version = $path . $version; } else { print <) { print "$1." if /major_version=(\d+)/; print "$1\n" if /minor_version=(\d+)/; } close IN; # Print last result info open(IN,"$userinfo") || die "Can't open $userinfo: $!\n"; while () { if (/^last_result_time=\s*([\d.]+)\s/) { $rtime = ($1 - 2440587.5) * 86400; # adjust Julian date $rtime = localtime(int($rtime)); print "Last result: $rtime\n"; next; } if (/^nresults=(\d+)$/) { print "Last number of results: $1\n"; last; } } close IN; # Print status of current work unit open(IN,"$statefile") || die "Can't open $statefile: $!\n"; @lines = ; close IN; foreach (@lines) { if (/^cpu=([\d.]+)$/) { $cpu = $1; next; } if (/^prog=([\d.]+)$/) { $prog = $1; last; } } $now = sprintf("%.3f",$prog * 100); print "Current progress: $now\%\n"; $graf = $prog * 50; print "[","*" x $graf, "-" x (50 - $graf),"]\n"; $subtotal = sprintf("%.2f",$cpu/3600); print "Now: $subtotal hrs / "; $total = sprintf("%.2f",$subtotal/$prog); print "Estimated remaining: ", $total - $subtotal, " hrs\n"; $time = scalar localtime(time + int($cpu/$prog - $cpu)); print "Estimated Total: $total hours @ $time\n", "Note: Time may extend to further test interesting data\n\n";