Changes between Initial Version and Version 1 of Scripts/Scheduler


Ignore:
Timestamp:
Dec 16, 2008, 10:21:38 PM (13 years ago)
Author:
Waldorf
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Scripts/Scheduler

    v1 v1  
     1= Bandwidth Scheduler Script =
     2== Notes ==
     3
     4
     5== Script ==
     6{{{
     7#!sh
     8#!/bin/bash
     9
     10# The script will limit speed settings between
     11# the following hours. Note: only use whole
     12# hours, minutes are not supported!
     13start_time=10
     14end_time=22
     15
     16# Normal speed setting:
     17normal_speed="-D -U"
     18# Speed limit setting:
     19limited_speed="-d100 -u20"
     20
     21# Authentication "username:password":
     22#tr_auth="admin:admin"
     23
     24# Transmission host:
     25tr_host="127.0.0.1:9091"
     26
     27# Verbose?
     28verbose=1
     29
     30#############################################
     31time=$(date +%H)
     32if [ $tr_auth ]; then
     33    tr_auth="--auth=$tr_auth"
     34fi
     35
     36if [[ $time -ge 1 ] -a [ $time -lt 10 ]]; then
     37    /usr/local/bin/transmission-remote "$tr_host $tr_auth $limited_speed" > /dev/null
     38    if [ $verbose ]; then date "+%Y-%m-%d (%H:%M:%S) Transmission speed limit changed"; fi
     39else
     40    /usr/local/bin/transmission-remote "$tr_host $tr_auth $normal_speed" > /dev/null
     41    if [ $verbose ]; then date "+%Y-%m-%d (%H:%M:%S) Transmission speed limit changed"; fi
     42fi
     43
     44exit 0
     45}}}