]> git.codelabs.ch Git - muen.git/blob - deploy/start_shutdown_epc.sh
Various minor fixes and improvements
[muen.git] / deploy / start_shutdown_epc.sh
1 #!/bin/bash
2 #
3 # Start or stop target host using the GUDE Expert Power Control (EPC) NET power
4 # connector [1]. The target is assumed to be plugged in port 1.
5 #
6 # [1] - http://wiki.gude.info/FAQ_EPC_CmdLine#Beispiele
7
8 DEVICE=$1
9 ACTION=$2
10 WGET="wget --quiet --delete-after"
11 URL="http://$DEVICE/ov.html?cmd=1&p=1&s="
12
13 if [ "$#" -ne 2 ]; then
14         echo "$0 <ip> <start|shutdown>"
15         exit 2
16 fi
17
18 SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
19
20 source $SCRIPTDIR/args.sh
21
22 case $ACTION in
23         start)
24                 $WGET "${URL}1"
25                 ;;
26         shutdown)
27                 $WGET "${URL}0"
28                 ;;
29 esac