tangetools/audioping/audioping
2023-11-07 01:33:57 +01:00

70 lines
1.3 KiB
Bash
Executable file

#!/bin/bash
: <<=cut
=pod
=head1 NAME
audioping - Play a sound if ping succeeds
=head1 SYNOPSIS
B<audioping> [options for ping]
=head1 DESCRIPTION
B<audioping> runs B<ping> and if B<ping> writes 'bytes from',
B<audioping> plays a sound.
=head1 EXAMPLE
Ping fsf.org
audioping fsf.org
=head1 AUTHOR
Copyright (C) 2023 Ole Tange,
http://ole.tange.dk and Free Software Foundation, Inc.
=head1 LICENSE
Copyright (C) 2012 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
at your option any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
=head1 DEPENDENCIES
B<audioping> uses B<ping> and B<perl>.
=head1 SEE ALSO
B<ping>
=cut
bip() {
play -q -n synth sine F4 sine C3 remix - fade 0 4 .0 norm -20 bend 0.1,2477,0.1 fade 0 0.3 0.1 2>/dev/null;
}
export -f bip
ping "$@" | perl -pe '/bytes from/ and qx{ bash -c bip }'