#!/bin/sh HOST="silveiraneto.net" if ping -c 1 $HOST > /dev/null then echo your command fi
- replace silveiraneto.net for your desired hostname or ip
- ping sends only one package (-c 1) and ignores the text output
- a ping is successful returns 0 and the if proceeds
- replace the echo line with your command
Be First to Comment