You are not logged in.
Here is the conky in question:
It displays the status of transmission downloads, etc.
#!/bin/sh
#conkytrans.sh
#transmission info in conky
host=127.0.0.1 #host:port
SERVICE='transmission'
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
echo "$SERVICE service running, everything is fine"
for number in `transmission-remote -l | awk '{print $1}' | sed '1d;$d'`
do
torrentinfo=`transmission-remote "$host" -t $number -i`
name=`echo "$torrentinfo" | grep Name: | sed -e 's/\s\sName:\s//'`
percent=`echo "$torrentinfo" | grep Percent | ssed -R 's/\ \ Percent\ Done:\ (\d+.\d+%)/\1/'`
percentbar=`echo $percent | ssed -R 's/(\d+).\d+%/\1/'`
if [ "$percentbar" -lt "10" ];then
percentbar=`echo $percentbar | ssed -R 's/(\d)/0\1/'`
fi
total=`echo "$torrentinfo" | grep Total | ssed -R 's/\ \ Total\ size:\ (\d+.\d+\ \w{2}).*/\1/'`
download=`echo "$torrentinfo" | grep "Download Speed" | sed 's/\ \ Download\ Speed:\ //'`
eta=`echo "$torrentinfo" | grep ETA | sed 's/\ \ ETA:\ //'`
echo "$name"
echo "$percent of $total"
echo '${execbar echo '$percentbar'}'
echo "$download" "$eta"
echo "------------------------------"
done
else
echo "$SERVICE is not running"
fi
I'll check it out in the terminal when I have transmission running.
Offline
Not a conky - a bash script that conky calls BUT there's your problem:
echo '${execbar echo '$percentbar'}'
try this:
${execbar echo '$percent'}
execbar command Same as exec, except if the first value return is a value between 0-100, it will use that number for a bar. The size for bars can be controlled via the default_bar_size config setting.
execbar creates the bar - all you need is the number and I'm guessing the '$percent' is coming from transmission.
I don't have transmission running so can't test.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
^ But "$percentbar" is a bash variable in this case, which I guess is an actual number.
@OP
I seriously advise that you run that script through shellcheck (you can install it or do it online). The script is riddled with unquoted variables and deprecated syntax, which could produce unexpected behaviour which could be very difficult to track down
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
OK, I tried shellcheck:
Your Terminal
$ shellcheck myscript
Line 9:
if ps ax | grep -v grep | grep $SERVICE > /dev/null
^-- SC2009: Consider using pgrep instead of grepping ps output.
Line 12:
for number in `transmission-remote -l | awk '{print $1}' | sed '1d;$d'`
^-- SC2006: Use $(..) instead of legacy `..`.
Line 14:
torrentinfo=`transmission-remote "$host" -t $number -i`
^-- SC2006: Use $(..) instead of legacy `..`.
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 15:
name=`echo "$torrentinfo" | grep Name: | sed -e 's/\s\sName:\s//'`
^-- SC2006: Use $(..) instead of legacy `..`.
Line 16:
percent=`echo "$torrentinfo" | grep Percent | ssed -R 's/\ \ Percent\ Done:\ (\d+.\d+%)/\1/'`
^-- SC2006: Use $(..) instead of legacy `..`.
Line 17:
percentbar=`echo $percent | ssed -R 's/(\d+).\d+%/\1/'`
^-- SC2006: Use $(..) instead of legacy `..`.
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 19:
percentbar=`echo $percentbar | ssed -R 's/(\d)/0\1/'`
^-- SC2006: Use $(..) instead of legacy `..`.
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 21:
total=`echo "$torrentinfo" | grep Total | ssed -R 's/\ \ Total\ size:\ (\d+.\d+\ \w{2}).*/\1/'`
^-- SC2006: Use $(..) instead of legacy `..`.
Line 22:
download=`echo "$torrentinfo" | grep "Download Speed" | sed 's/\ \ Download\ Speed:\ //'`
^-- SC2006: Use $(..) instead of legacy `..`.
Line 23:
eta=`echo "$torrentinfo" | grep ETA | sed 's/\ \ ETA:\ //'`
^-- SC2006: Use $(..) instead of legacy `..`.
Line 27:
${execbar echo '$percentbar'}
^-- SC2154: execbar is referenced but not assigned.
^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.
$
but, I'm afraid I don't understand much of it!
Any help would be appreciated.
Offline
I think it is the last error that is the problem
Line 27:
${execbar echo '$percentbar'}
^-- SC2154: execbar is referenced but not assigned.
^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.
Try
echo "\${execbar echo $percentbar}"
...but, I'm afraid I don't understand much of it!
Welcome to the wonderful world of bash scripting (Loads of tutorials online BTW)
-----
See the difference here: you want to output a literal "${....}", so you need to escape the "$". Try it in a terminal
damo@graphix ~ $ percentbar=100
damo@graphix ~ $ echo "${execbar echo $percentbar}"
bash: ${execbar echo $percentbar}: bad substitution
damo@graphix ~ $ echo "\${execbar echo $percentbar}"
${execbar echo 100}
Last edited by damo (2017-01-28 15:16:34)
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
Welcome to the wonderful world of bash scripting big_smile (Loads of tutorials online BTW)
Yeah, I know!
Problem is, I don't use scripts enough to sit down and learn thoroughly.
It's a bit like having to learn Chinese when all you want is some noodles!
Thanks for help!
Offline
^ But "$percentbar" is a bash variable in this case, which I guess is an actual number.
OOPS! I have conky-brain can't see past conky variables.
Pass the noodles HoaS.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Ok
Have just used transmission, the modified bash script works fine and no errors given in xsession-errors.
Offline