Last active
          November 8, 2023 06:50 
        
      - 
      
- 
        Save ailequal/145f21d60eada9e5e31473f08c38bcfe to your computer and use it in GitHub Desktop. 
    pinger
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/bash | |
| ############# | |
| # pinger.sh # | |
| ############# | |
| # Ping every 30 seconds "192.168.0.1". | |
| # If the ping fails, play a sound for alerting the user. | |
| # The loop can only be stopped manually by the user. | |
| while true; do | |
| if ! ping -c 1 192.168.0.1 > /dev/null; then | |
| echo "Ping failed! Alerting..." | |
| # Choose between one of these methods below. | |
| # paplay /usr/share/sounds/freedesktop/stereo/bell.oga # Play a beep sound. | |
| # mpv "/path/to/custom/audio/file.mp4" # Play any kind of audio. | |
| fi | |
| sleep 30 | |
| done | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment