--- sms.alert 2003/02/21 10:36:01 1.7 +++ sms.alert 2003/10/28 17:37:05 1.8 @@ -20,6 +20,7 @@ # -f send flash sms (directly to screen) # -x send extended message (all output, smstools with split it in # multiple smses if needed) +# -i hh:mm-hh:mm send sms only if it falls in this interval # # it users file /usr/local/etc/sms.addressbook as addressbook in format # @@ -38,7 +39,7 @@ use strict; my %opt; use Getopt::Std; -getopts ("S:s:g:h:t:l:uf", \%opt); +getopts ("S:s:g:h:t:l:ufi:", \%opt); # read addressbook my %name2phone; @@ -63,6 +64,18 @@ my $summary = shift @MSG; chomp $summary; +if ($opt{i}) { + if ($opt{i} =~ /(\d+):(\d+)-(\d+):(\d+)/) { + my $from = $1 * 60 + $2; + my $to = $3 * 60 + $4; + my ($sec,$min,$hour) = localtime(time); + my $t = $hour * 60 + $min; + exit 0 if ($t < $from || $t > $to); + } else { + die "interval time format: hh:mm-hh:mm" + } +} + $summary = $opt{S} if $opt{S}; my ($wday,$mon,$day,$tm) = split (/\s+/, localtime);