Created
August 17, 2015 13:37
-
-
Save defektive/7ca837cc7cc7583dc781 to your computer and use it in GitHub Desktop.
simple shell script to run my sprinklers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# station durations | |
STATION_1=10 | |
STATION_2=5 | |
STATION_3=5 | |
STATION_5=5 | |
STATION_6=5 | |
# shouldnt need top change beyond here | |
OSPI='/root/.gem/ruby/2.2.0/bin/ospi' | |
PROGRAM="1,$STATION_1 2,$STATION_2 3,$STATION_3 5,$STATION_6 6,$STATION_6" | |
for i in $PROGRAM; do IFS=","; set $i; | |
echo "Run Station $1 for $2 minutes"; | |
run_station $1 $2 | |
done | |
$OSPI stop 1 | |
run_station () { | |
$station=$1 | |
$duration=`echo "$2 * 60" | bc` | |
echo "Running Station $station for $duration seconds" | |
# $OSPI start $station | |
sleep $duration | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment