You are not logged in.
Hi all - I'm a new Arch user, recently upgraded from Mint. So far I'm loving my Openbox setup on my netbook, with one little problem.
I was inspired by this for my conky system monitor:
https://bbs.archlinux.org/viewtopic.php?id=37284
but I don't know python, barely know bash and wanted to learn something about pacman by doing it myself. I've got the "pacman -Sy" sync script in my cron.hourly and the following script works fine in the shell and SOMETIMES in the conky display.
#!/bin/bash
#return the download size of the packages needing updates
rm -f /tmp/list.txt
rm -f /tmp/sizey.txt
pacman -Qu | awk '{print $1}' > /tmp/list.txt
if [ ! -s /tmp/list.txt ]; then
echo "UPDATED"
else
size=0
cat /tmp/list.txt |while read pkgname; do
tempsize=$(cat /var/lib/pacman/sync/*/$pkgname*/desc | grep -A 1 %CSIZE% | grep -v %CSIZE%)
size=$(($size + $tempsize))
echo $size > /tmp/sizey.txt
done
sizey=$(cat /tmp/sizey.txt)
sizemb=$(($sizey / 1048576))
pkgnumber=$(pacman -Qu | wc -l)
echo "$pkgnumber,$sizemb MB"
fi
running in the shell right now gives:
sh pacsize.sh
4,0 MB
(meaning 4 packages need updating, with less than 1MB to download) I'm not blessed with screen space on my netbook, so this output is all I need.
This is in my conkyrc: ${execi 3650 sh pacsize.sh}
Twice now I have seen the output show up as expected, and then later that day show nothing. This is happening right now - but, as above, the script is working. One thing I noticed is that it takes just over a second for the script to finish in the shell. This makes sense because it has to scan through the entire /var/lib/pacman/sync folder.
My theory for this inconsistent behavior is that the script takes to long to finish and therefore "misses" the window of time that conky allows during each refresh. I am not a programmer, so this theory is probably overly simplistic, but I need some help. Any ideas or ways to diagnose how conky is handling my script?
Offline
Twice now I have seen the output show up as expected, and then later that day show nothing. This is happening right now - but, as above, the script is working. One thing I noticed is that it takes just over a second for the script to finish in the shell. This makes sense because it has to scan through the entire /var/lib/pacman/sync folder.
My theory for this inconsistent behavior is that the script takes to long to finish and therefore "misses" the window of time that conky allows during each refresh. I am not a programmer, so this theory is probably overly simplistic, but I need some help. Any ideas or ways to diagnose how conky is handling my script?
You could try setting the value of update_interval to some value larger than 1 and see if it resolves the problem.
Offline
Ha! It works!
I guess I assumed the update interval was the time between "instantaneous" updates. Good to know. Thanks skunktrader.
EDIT:
This does make my cpu and network load monitors less informative with the delay... Guess I should go for a faster script.
Last edited by presentgear (2010-12-14 04:05:06)
Offline