Commit | Line | Data |
406c51ee |
1 | #!/usr/local/bin/perl |
2 | |
3 | use blib; |
4 | use Getopt::Long; |
5 | use Net::SNPP; |
6 | |
7 | $opt_debug = undef; |
8 | $opt_h = undef; |
9 | $opt_p = undef; |
10 | |
11 | GetOptions(qw(debug h p)); |
12 | |
13 | die "usage: $0 -h <host> -p <pagerid> <message>" |
14 | unless defined $opt_h && defined $opt_p && @ARGV; |
15 | |
16 | Net::SNPP->debug(1) |
17 | if $opt_debug; |
18 | |
19 | $snpp = Net::SNPP->new($opt_host); |
20 | |
21 | $snpp->pager_id($opt_p) || die $snpp->message; |
22 | $snpp->content(join(" ",@ARGV)) || die $snpp->message; |
23 | $snpp->send() || die $snpp->message; |
24 | |
25 | $snpp->quit; |
26 | |
27 | __END__ |
28 | |
29 | or you could dp |
30 | |
31 | $snpp = Net::SNPP->new($opt_host); |
32 | |
33 | $snpp->send( Pager => $opt_p, |
34 | Message => join(" ",@ARGV), |
35 | Alert => 1, |
36 | Hold => time + 3600 |
37 | ) || die $snpp->message; |
38 | |
39 | $snpp->quit; |