Results 1 to 10 of 11
Hi,
So I'm running Fluxbox as my window manager in Xubuntu. I use ivman to automatically mount any usb devices.
Now I was wondering if it's possible to have conky ...
- 09-18-2010 #1Just Joined!
- Join Date
- Mar 2006
- Posts
- 26
Conky Display all Mounted Drives
Hi,
So I'm running Fluxbox as my window manager in Xubuntu. I use ivman to automatically mount any usb devices.
Now I was wondering if it's possible to have conky display all mounted drives and some information about them.
I saw you can do {$ifmounted /media/blah} but this would assume I have a set number of devices preconfigured in fstab. It doesn't account for some random guy's flash drive, or a buddy's smartphone.
I know mount | grep sd outputs a list of mounted drives. So then could I somehow format that output and pass it to conky? Or do you guys have any more clever ideas on how I could accomplish this?
- 09-20-2010 #2
You could look at the output of 'df', which gives a list of the sizes of the available drives. Sometimes I find this output to be easier to read than 'mount'.
You could also try grepping around in the /proc directory - start by looking at 'partitions' or 'diskstats'.Linux user #126863 - see http://linuxcounter.net/
- 09-20-2010 #3Just Joined!
- Join Date
- Mar 2006
- Posts
- 26
Thanks for the advice.
I came up with the following command:
df | sed '/none/d' | sed 1d | cut -d% -f2
This displays all current mount points, line by line, e.g.:
/
/media/usb
I can pass this info to conky, which is sort of okay, but how could I manipulate the output in order to get information such as fs_free_perc or fs_bar?
- 09-20-2010 #4
You could use /etc/mtab
- 11-03-2010 #5Just Joined!
- Join Date
- Dec 2007
- Posts
- 16
So, did you find a clean way of doing it?
for now I have all my drives listed in my conkyrc file, which is kinda messy since I can have at most 3 drives installed at a time.
- 11-04-2010 #6Just Joined!
- Join Date
- Mar 2006
- Posts
- 26
I kinda gave up on it to be honest. When you have a bunch of flash drives, external hard drives, etc., fstab just doesn't cut it. So I'm using some application to automatically mount the drives for me.
So if I wanted to get a beautiful, automatically updating conkyrc displaying all the mounted drives, I'm not sure how I would do it. You might have to configure whatever application is mounting the drives to also update a text file or run a script which would get the right info displayed in conky.
Let me know if you figure something out.
- 11-04-2010 #7Just Joined!
- Join Date
- Dec 2007
- Posts
- 16
Well, I just threw this together after your post. I guess this is what I'm using now.
It'd be nice to hook the percentage up to a "bar" so that it would have visual representation of the percentage.
Code:${exec df -h | grep "/dev/sd" | awk '{ printf "%s of %s \t : %s\n", $5, $2, $6 }' }
- 11-06-2010 #8Just Joined!
- Join Date
- Mar 2006
- Posts
- 26
That's amazing. I didn't know awk could split an output like that, just with the number of which entry you're looking for.
As for the bar, can't you just do:
execbar$(df -h | grep "/dev/sd" | awk '{ printf "%s", $5 }'
then that would just leave the matter of re-executing that command every time a drive is added or removed.
- 11-06-2010 #9Just Joined!
- Join Date
- Dec 2007
- Posts
- 16
- 11-21-2010 #10Just Joined!
- Join Date
- Dec 2007
- Posts
- 16
update!
I wanted to add the "free space" of drives, so I edited the code:
Let me know if you have any ideas.Code:df -h | grep "/dev/sd" | awk 'BEGIN { print "free\ttotal\tfull" } { printf "%s\t%s\t%s\t%s\n", $4, $2, $5, $6 }'


Reply With Quote
