Wake-On-LAN Script

#!/bin/zsh
# Wake on LAN script
# Dominic Reich <dominic@tmsn.at>
# Last modified: Freitag, 10.07.2015 20:16
#
# This script will probably only run on zsh shell (!)
# The package <wakeonlan> needs to be installed already!

declare SELECTION;

WAKE='/usr/bin/wakeonlan';

while [ -z "$SELECTION" -o "$SELECTION" != "q" ]; do
  clear ;
  echo "Wake on LAN script- by Dominic Reich";
  echo "====================================";
  echo ;
  echo -e "  \e[31m\e[1mb\e[0muero";
  echo -e "  \e[31m\e[1ms\e[0merver";
  echo -e "  \e[31m\e[1md\e[0maniel";
  echo ;
  echo -e "  \e[31m\e[1mq\e[0muit this tool";
  echo -e "  \e[31m\e[1mi\e[0mnfo about this tool";
  echo ;
  read SELECTION\?"What's your selection: ";
  if [ "$SELECTION" = "b" ]; then
    $WAKE FF:FF:FF:FF:FF:FF;
  fi
  if [ "$SELECTION" = "s" ]; then
    $WAKE FF:FF:FF:FF:FF:FF;
  fi
  if [ "$SELECTION" = "d" ]; then
    #$WAKE FF:FF:FF:FF:FF:FF;
    echo "sorry this computer is out of order"
  fi
  if [ "$SELECTION" = "i" ]; then
    clear ;
    echo -e "\e[31m\e[1mWake on LAN script by Dominic Reich\e[0m"
    echo ;
    echo -e "This script can be used to wake certain computers in your"
    echo -e "local network."
    echo ;
    echo -e "This script only calls 'wakeonlan' with some arguments,"
    echo -e "so don't expect this to work without 'wakeonlan' installed."
    echo ;
    read \?"press [enter] to continue"
  fi
  echo ;
done

Leave a Comment