start_client()
{
local client_type=$1
- local torrent_file=$2
+ local torrent_file=$2
DEBUG echo "starting client ..."
case "${client_type}" in
- "hrktorrent_seeder")
- ./start_hrk_seeder.sh ${torrent_file} &
- return $!
- ;;
- "hrktorrent_leecher")
- ./start_hrk_leecher.sh ${torrent_file} &
- return $!
- ;;
+ "hrktorrent_seeder")
+ ./start_hrk_seeder.sh ${torrent_file} &
+ return $!
+ ;;
+ "hrktorrent_leecher")
+ ./start_hrk_leecher.sh ${torrent_file} &
+ return $!
+ ;;
esac
}
DEBUG echo "stopping client ..."
case "${client_type}" in
- "hrktorrent_seeder")
- ./stop_hrk.sh
- ;;
- "hrktorrent_leecher")
- ./stop_hrk.sh
- ;;
+ "hrktorrent_seeder")
+ ./stop_hrk.sh
+ ;;
+ "hrktorrent_leecher")
+ ./stop_hrk.sh
+ ;;
esac
}
suspend_client()
{
- local client_pid=$1
+ local client_pid=$1
DEBUG echo "suspending client ..."
kill -STOP ${client_pid}
}
resume_client()
{
- local client_pid=$1
+ local client_pid=$1
DEBUG echo "resuming client ..."
kill -CONT ${client_pid}
}
for ((i = 0; i < ${#suspend_resume[@]}; i += 2)); do
to_sleep=$((${suspend_resume[$i]} - ${old_time}))
sleep ${to_sleep}
- client_pid=$(pgrep -P ${background_pid})
- DEBUG echo "client_pid is ${client_pid}"
+ client_pid=$(pgrep -P ${background_pid})
+ DEBUG echo "client_pid is ${client_pid}"
suspend_client ${client_pid}
old_time=${suspend_resume[$i]}