#!/bin/bash # Utilisation: ./hostup <nom_ou_ip_de_la_machine> SOUND="/usr/share/apps/korganizer/sounds/alert.wav" FLAG=0 FLAG_ALERT=0 while [ "$FLAG" = "0" ] do ping -c 1 -w 10 $1 >/dev/null 2>/dev/null if [ $? = 0 ] then if [ "$FLAG_ALERT" = "0" ] then xmessage "$1 ONLINE!" & PID_XMESSAGE=$! FLAG_ALERT=1 fi # /usr/bin/sox $SOUND -t .au - > /dev/audio & play $SOUND PLAY_PID=$! sleep 30 if [ "`ps $PID_XMESSAGE >/dev/null; echo $?`" = "1" ] then FLAG="1" fi fi sleep 1 done