ControlScripts: draft working client_schedule scripts
authorRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Tue, 3 Aug 2010 12:53:38 +0000 (15:53 +0300)
committerRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Tue, 3 Aug 2010 12:53:38 +0000 (15:53 +0300)
ControlScripts/client_schedule.sh

index 538dbfe..733fe7b 100755 (executable)
@@ -7,8 +7,15 @@
 #  * starts/stops a client
 #  * manages when client completes
 
-if [ ! $# -le 3 ]; then
-       echo "usage: $0 client-type torrent-file periods"
+_DEBUG="on"
+
+DEBUG()
+{
+       test ${_DEBUG} = "on" && $@
+}
+
+if test $# -le 3; then
+       echo "usage: $0 client-type torrent-file periods" 1>&2
        exit 1
 fi
 
@@ -42,24 +49,30 @@ parse_periods()
 
 start_client()
 {
-       echo "starting client ..."
+       DEBUG echo "starting client ..."
 }
 
 stop_client()
 {
-       echo "stopping client ..."
+       DEBUG echo "stopping client ..."
 }
 
 suspend_client()
 {
-       echo "suspending client ..."
+       DEBUG echo "suspending client ..."
 }
 
 resume_client()
 {
-       echo "resuming client ..."
+       DEBUG echo "resuming client ..."
 }
 
+parse_periods
+
+DEBUG echo "start_time is ${start_time}"
+DEBUG echo "suspend_resume is ${suspend_resume[@]}"
+DEBUG echo "stop_time is ${stop_time}"
+
 to_sleep=${start_time}
 sleep ${to_sleep}
 start_client