From 14d446a96eb62071db89e03bf23f335b28dd6bfb Mon Sep 17 00:00:00 2001 From: Razvan Deaconescu Date: Tue, 3 Aug 2010 15:53:38 +0300 Subject: [PATCH] ControlScripts: draft working client_schedule scripts --- ControlScripts/client_schedule.sh | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/ControlScripts/client_schedule.sh b/ControlScripts/client_schedule.sh index 538dbfe..733fe7b 100755 --- a/ControlScripts/client_schedule.sh +++ b/ControlScripts/client_schedule.sh @@ -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 -- 2.20.1