Bash script that utilize ping command with visual, audio and statistics aids.
mping runs as like ping but it has to get an integer as second parameter which express the minimum allowed response time in milliseconds. Any response takes more than that time, mping will highlight it in red color and plays beep command with beep sound.
After exit the command CTRL C a simple statistics with total run time, shortest response time, longest response time and the count of exceeded response will be printed.
./mping.sh 192.168.1.1 20
You also can copy it to /usr/bin to run it globally as a command:
chmod +x mping.sh
sudo cp mping.sh /usr/bin/mping
For systems that do not support the beep command such as OpenSuse. You can install the sox package and then use it play a mp3 file with the beep sound from a bash script named beep placed in /usr/bin directory with execution permissions. The following steps may help:
- Install
soxpackagesudo zypper install sox - Create a file named
beep.shwith the following lineplay -q beep-sound.mp3and save the file. - Download any beep mp3 sound file of your choice and rename it to
beep-sound.mp3 - Make the bash script file executable by
chmod +x beep.sh - copy the two files to
/usr/binbysudo cp beep.sh /usr/bin/beepnote, we removed the extension frombeep.shandsudo cp beep-sound.mp3 /usr/bin/beep-sound.mp3
Now the beep command inside the script will be emulated using the script we have done above.
This script has initiated using Bing Chat and I added some modifications to it.
