Page 2 of 2
Re: Bash script issue - not displaying onscreen [SOLVED]
Posted: Fri May 31, 2024 2:16 pm
by Logansfury
Update time in place and seems to be functioning fine. It's on an
execi 60
just like the speed query and time is changing between a fraction of a second or 1 second after the sound alert.
Re: Bash script issue - not displaying onscreen [SOLVED]
Posted: Fri May 31, 2024 2:30 pm
by Logansfury
Hey Koentje,
Not too infrequently, the speed.tmp is getting double readings (lag maybe?)
tmp file starts looking like this:
and this happens to the widget:
Can you suggest a fix to ignore the one of the sets of duped values?
Re: Bash script issue - not displaying onscreen [SOLVED]
Posted: Fri May 31, 2024 3:54 pm
by Koentje
Post your bash script, or i have no clue on how to help you!
I checked my account on the provider and i should have way more transferrspeeds than i get now so i filed a complain. Maybe my modem needs to be replaced?
Account says 750mbit down and 60mbit up, but i get 75mbit down and 20mbit up.
Re: Bash script issue - not displaying onscreen [SOLVED]
Posted: Fri May 31, 2024 4:03 pm
by Logansfury
Koentje wrote: ⤴Fri May 31, 2024 3:54 pm
Post your bash script, or i have no clue on how to help you!
I checked my account on the provider and i should have way more transferrspeeds than i get now so i filed a complain. Maybe my modem needs to be replaced?
Account says 750mbit down and 60mbit up, but i get 75mbit down and 20mbit up.
I have had to get a lot of modems replaced over the years, and I have a tech coming over this evening to deduce why my current modem has no light activity.
Here come the scripts!
conkyrc
Code: Select all
conky.config = {
background = false,
alignment = 'middle_right',
gap_x = -60,
gap_y = -20,
minimum_width = 600,
maximum_width = 600,
minimum_height = 130,
default_color = 'gray',
default_outline_color = 'black',
default_shade_color = 'black',
draw_borders = false,
border_width = 0,
border_inner_margin = 0,
border_outer_margin = 0,
draw_shades = false,
draw_outline = true,
draw_graph_borders = false,
double_buffer = true,
no_buffers = true,
uppercase = false,
own_window = true,
own_window_class = 'conky-cooling-fans',
own_window_title = 'conky-cooling-fans',
own_window_type = 'dock',
own_window_transparent = true,
own_window_colour = '000000',
own_window_argb_visual = true,
own_window_argb_value = 0,
own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
override_utf8_locale = true,
use_xft = true,
font = 'droid sans:size=14',
xftalpha = 1,
update_interval = 5,
};
-- leet chars U+ EAC8 U+ EB92 U+ ED01 U+ E94A
conky.text = [[
${execpi 300 ./speed.sh}
]];
bash script
Code: Select all
#!/bin/bash
# Define your functions
function first_function {
if command -v speedtest-cli >/dev/null 2>&1; then
speedtest-cli > ./speed.tmp
speedtest-cli --bytes >> ./speed.tmp
if [ $? -eq 0 ]; then
sleep 0.5
else
echo "\${goto 132}\${color white}\${voffset -24}Speedtest failed to run"
fi
else
echo "speedtest-cli is not installed or not in PATH."
exit 1
fi
}
function second_function {
if [ -f ./speed.tmp ]; then
down=$(cat ./speed.tmp | grep -E "Download: .*Mbit/s" | awk '{print $2" "$3}')
bytes_dwn=$(cat ./speed.tmp | grep -E "Download: .*Mbyte/s" | awk '{print $2" "$3}')
up=$(cat ./speed.tmp | grep -E "Upload: .*Mbit/s" | awk '{print $2" "$3}')
bytes_up=$(cat ./speed.tmp | grep -E "Upload: .*Mbyte/s" | awk '{print $2" "$3}')
ping=$(sed -n '5p' speed.tmp | awk '{print $(NF-1)}')
else
echo "Speedtest result file not found."
exit 1
fi
}
function third_function {
echo "\${goto 35}\${color red}\${font Droid Sans:size=18}Speed Test\${font Material:size=24}\${voffset 4}\${font}\${voffset -3}Ping : \${color white}$ping ms"
echo "\${goto 35}\${voffset 8}\${color red}\${font Material:size=26}\${voffset -16}\${font}\${voffset -4}Download Spd : \${color white}$down\${color red}/\${color white}$bytes_dwn"
echo "\${goto 35}\${color red}\${font Material:size=26}\${voffset -8}\${font}\${voffset -4}Upload Spd : \${color white}$up\${color red}/\${color white}$bytes_up"
echo "\${goto 350}\${color red}\${font Symbola:size=12} 🔁 \${color white}\${font Droid Sans:size=8}\${execi 60 date +'%l:%M:%S %p' | sed 's/^0//g'}\${font}"
}
function fourth_function {
gst-launch-1.0 -q playbin uri=file:///usr/share/mint-artwork/sounds/map.oga
}
# Call your functions in sequence
first_function
second_function
third_function
fourth_function
Re: Bash script issue - not displaying onscreen [SOLVED]
Posted: Fri May 31, 2024 5:47 pm
by Koentje
I wouldn't do this
Code: Select all
speedtest-cli > ./speed.tmp
speedtest-cli --bytes >> ./speed.tmp
but instead do this
Code: Select all
speedtest-cli > ./speed-bits.tmp
speedtest-cli --bytes > ./speed-bytes.tmp
And then read from those files seperate!
Re: Bash script issue - not displaying onscreen [SOLVED]
Posted: Fri May 31, 2024 6:43 pm
by Logansfury
Koentje wrote: ⤴Fri May 31, 2024 5:47 pm
I wouldn't do this
Code: Select all
speedtest-cli > ./speed.tmp
speedtest-cli --bytes >> ./speed.tmp
but instead do this
Code: Select all
speedtest-cli > ./speed-bits.tmp
speedtest-cli --bytes > ./speed-bytes.tmp
And then read from those files seperate!
Right on, I can perform that edit. I am getting the positioning and size squared away on my laptop, then I will convert both the PC and Laptop scripts to dual log
Re: Bash script issue - not displaying onscreen [SOLVED]
Posted: Fri May 31, 2024 6:46 pm
by Koentje
And don't forget, they have both single >
's !
Re: Bash script issue - not displaying onscreen [SOLVED]
Posted: Fri May 31, 2024 8:12 pm
by Logansfury
Koentje wrote: ⤴Fri May 31, 2024 6:46 pm
And don't forget, they have both single
>
's !
That's to ensure the new data overwrites the old so the file doesnt grow large over time?
Re: Bash script issue - not displaying onscreen [SOLVED]
Posted: Fri May 31, 2024 8:14 pm
by Koentje
Logansfury wrote: ⤴Fri May 31, 2024 8:12 pm
That's to ensure the new data overwrites the old so the file doesnt grow large over time?
Yup!