tele-watch.pl
changeset 11 374f2c5ea187
parent 10 e6e2dd28a22e
child 14 9da9fe83c77c
equal deleted inserted replaced
10:e6e2dd28a22e 11:374f2c5ea187
    54     GetOptions(
    54     GetOptions(
    55         "h|help"  => sub { pod2usage(-exitval => 0, -verbose => 1) },
    55         "h|help"  => sub { pod2usage(-exitval => 0, -verbose => 1) },
    56         "m|man"   => sub { pod2usage(-exitval => 0, -verbose => 3) },
    56         "m|man"   => sub { pod2usage(-exitval => 0, -verbose => 3) },
    57         "block!"  => \$opt_block,
    57         "block!"  => \$opt_block,
    58         "daemon!" => \$opt_daemon,
    58         "daemon!" => \$opt_daemon,
    59         "kill"    => \$opt_kill,
    59         "k|kill"  => \$opt_kill,
       
    60 		"v|version" => \$opt_version,
    60         "pidfile=s" => \$opt_pidfile,
    61         "pidfile=s" => \$opt_pidfile,
    61       )
    62       ) or pod2usage();
    62       and @ARGV
       
    63       or pod2usage();
       
    64 
    63 
    65     if ($opt_kill) {
    64     if ($opt_kill) {
    66         die "$ME: Not killing anything, no pid file.\n";
    65         die "$ME: Not killing anything, no pid file.\n" if not $opt_pidfile;
    67         my $pid = readf($opt_pidfile);
    66         my $pid = readf($opt_pidfile);
    68         die "$ME: not killing anything, no pid.\n";
    67         die "$ME: not killing anything, no pid.\n" if not defined $pid;
    69         kill TERM => $pid
    68         kill TERM => $pid
    70           or die "$ME: can't kill $pid: $!\n";
    69           or die "$ME: can't kill $pid: $!\n";
    71         print "$ME: sent TERM signal to $pid\n";
    70         print "$ME: sent TERM signal to $pid\n";
    72         exit 0;
    71         exit 0;
    73     }
    72     }
    74 
    73 
    75     if ($opt_version) {
    74     if ($opt_version) {
    76         print "$ME:\n$VERSION";
    75         print "$ME: $VERSION";
    77         exit 0;
    76         exit 0;
    78     }
    77     }
    79 
    78 
       
    79 	pod2usage() if not @ARGV;
    80     foreach (@ARGV) {
    80     foreach (@ARGV) {
    81         my ($w, $t, $r) = split /:/;
    81         my ($w, $t, $r) = split /:/;
    82         die "$ME: too many \":\" in \"$_\"\n" if defined $r;
    82         die "$ME: too many \":\" in \"$_\"\n" if defined $r;
    83         pod2usage() if not defined $w or not defined $t;
    83         pod2usage() if not defined $w or not defined $t;
    84         $w          = abs_path($w);
    84         $w          = abs_path($w);
   381 =head1 AUTHOR and SOURCE
   381 =head1 AUTHOR and SOURCE
   382 
   382 
   383 Heiko Schlittermann <hs@schlittermann.de>.
   383 Heiko Schlittermann <hs@schlittermann.de>.
   384 The source may be found at L<https://keller.schlittermann.de/hg/ius/tele-watch>.
   384 The source may be found at L<https://keller.schlittermann.de/hg/ius/tele-watch>.
   385 
   385 
       
   386 =head1 VERSION
       
   387 
   386 <VERSION>
   388 <VERSION>
   387 
   389 
   388 
   390 
   389 =cut
   391 =cut
   390 
   392