#!/usr/bin/perl $interval = shift ; $mint = 5*60 ; if ($interval =~ /([\d]+)d/i) { $interval = ($1 * 24*3600) ; } elsif ($interval =~ /([\d]+)h/i) { $interval = ($1 * 3600) ; } elsif ($interval =~ /([\d]+)m/i) { $interval = ($1 * 60) ; } if ($interval and $interval < $mint) { die "interval too short $interval\n" ; } if ($interval) { print "Every $interval seconds\n" ; } $fbno = '32665' ; #Facebook $fbno = '21212' ; #Canada while (1) { open (IN,"demo5|") or die "Can't run demo5\n" ; while () { if (/T=([\d]+)[\s]+M=[\d]+[\s]+LAT=([\-\.\d]+)[\s]+LON=([\-\.\d]+)/) { $t = $1 ; $lat = $2 ; $lon = $3 ; } } unless (defined($lat) and $t) { die "No fix\n" ;; } $t = localtime($t) ; print "$t lat = $lat lon = $lon\n" ; $url = sprintf("http://andrew.triumf.ca/gm?%.4f%%2c%.4f",$lon,$lat) ; open (OUT,"|gnokii --sendsms $fbno") or die "Can't run gnokii\n" ; $s = $? ; print "s1 $s\n" ; print OUT "Location $url\n" ; $s = close(OUT) ; $s2 = $? ; print "s2 $s\n" ; print "s3 $s2\n" ; unless ($interval) { exit ; } sleep ($interval) ; }