Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <pre class="brush: bash">
- #!/bin/bash
- # programado por Juanmol para http://rsppi.blogspot.com
- RESP=/tmp/webresp
- puerto=8998
- log=/var/log/cambios_velocidad_transmission.log
- lento="/usr/local/bin/transmission-remote -as"
- rapido="/usr/local/bin/transmission-remote -AS"
- [ -p $RESP ] || mkfifo $RESP
- while true ; do
- ( cat $RESP ) | nc -l -p $puerto | (
- REQ=`while read L && [ " " "<" "$L" ] ; do echo "$L" ; done`
- if [ "$(echo $REQ | head -1 | cut -f2 -d\/)" == "transmission" ];
- then
- orden=$(echo $REQ | head -1 | cut -f3 -d\/);
- echo se recibe $orden a las $(date) >> $log ;
- if [ "$orden" = "rapido" ];
- then
- $rapido;
- fi
- if [ "$orden" = "lento" ];
- then
- $lento;
- fi
- fi
- cat >$RESP <<EOF
- HTTP/1.0 200 OK
- Cache-Control: private
- Content-Type: text/plain
- Server: bash/2.0
- Connection: Close
- Content-Length: 0
- EOF
- )
- done
- </pre>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement