Skip to content

Instantly share code, notes, and snippets.

@metal3d
Created February 22, 2011 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metal3d/839619 to your computer and use it in GitHub Desktop.
Save metal3d/839619 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
#Script de Démarrage des Ordinateurs sur l'interface réseau eth1
#
MACADDR=00:50:BA:CB:CD:B8
/usr/bin/wol -i 192.168.1.255 $MACADDR
#Maintenant on tourne en boucle et on attend que le pc annonce qu'il existe
notalive=1
while [ $notalive == "1" ]
do
avahi-browse-domains -at | grep $MACADDR
#$? vaut 1 si grep a foiré, 0 si il a marché, donc si la machine est trouvé, $? vaut 0
#on assigne ça à notalive, et on va quitter la boucle
notalive=$?
done
#on annonce que le pc est trouvé
notify-send "PC allumé" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment