conky script needs partition info

New to SolydXK? This is the place to start.
Please check the other subforums to see if there's a more suitable place for your question.
Albert
Posts: 70
Joined: 16 Mar 2014 16:37

conky script needs partition info

Postby Albert » 16 Mar 2014 19:00

I have a conky script that I have been using on Ubuntu/Mint. I have several OSes installed and each uses the same script. In that script I look into /etc/mtab for the current partition of the OS. However, SolydX redirects to some place named "self". Where can I, in SolydX, find the current partition?

User avatar
zerozero
Posts: 5373
Joined: 10 Feb 2013 23:37
Location: West Midlands, England
Contact:

Re: conky script needs partition info

Postby zerozero » 16 Mar 2014 19:54

hi Albert ;) welcome to the SolydXK community

since the wheezy release /etc/mtab is a symlink to /proc/mounts (https://www.debian.org/releases/stable/ ... .html#mtab)
bliss of ignorance

Albert
Posts: 70
Joined: 16 Mar 2014 16:37

Re: conky script needs partition info

Postby Albert » 16 Mar 2014 21:56

Thank you. I should have been more clear. /proc/mounts is intermediate in the chain, and points to self/mounts. I have never seen such a link, i.e. there is no "self" dir.

User avatar
zerozero
Posts: 5373
Joined: 10 Feb 2013 23:37
Location: West Midlands, England
Contact:

Re: conky script needs partition info

Postby zerozero » 16 Mar 2014 22:12

:) maybe this helps
(mounts exists in proc/mounts but as a symlink to /proc/self/mounts)

Code: Select all

zerozero@home /proc $ ls -lA | grep moun
lrwxrwxrwx  1 root       root                    11 Mar 16 22:03 mounts -> self/mounts

Code: Select all

zerozero@home /proc/self $ ls -lA | grep mount
-r--r--r-- 1 zerozero zerozero 0 Mar 16 22:04 mountinfo
-r--r--r-- 1 zerozero zerozero 0 Mar 16 22:04 mounts
-r-------- 1 zerozero zerozero 0 Mar 16 22:04 mountstats
and in all 3 situations cat reads the file without problems

Code: Select all

zerozero@home ~ $ cat /etc/mtab
rootfs / rootfs rw 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
udev /dev devtmpfs rw,relatime,size=10240k,nr_inodes=2042814,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=1636228k,mode=755 0 0
/dev/disk/by-uuid/a48af464-6f1a-4e64-b2e1-57099ef44ab2 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
tmpfs /run/shm tmpfs rw,nosuid,nodev,noexec,relatime,size=5368160k 0 0
fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
/dev/sda2 /home ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0
cgroup /dev/cgroup/cpu cgroup rw,relatime,cpu,release_agent=/usr/local/sbin/cgroup_clean 0 0

Code: Select all

zerozero@home ~ $ cat /proc/mounts
rootfs / rootfs rw 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
udev /dev devtmpfs rw,relatime,size=10240k,nr_inodes=2042814,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=1636228k,mode=755 0 0
/dev/disk/by-uuid/a48af464-6f1a-4e64-b2e1-57099ef44ab2 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
tmpfs /run/shm tmpfs rw,nosuid,nodev,noexec,relatime,size=5368160k 0 0
fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
/dev/sda2 /home ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0
cgroup /dev/cgroup/cpu cgroup rw,relatime,cpu,release_agent=/usr/local/sbin/cgroup_clean 0 0

Code: Select all

zerozero@home ~ $ cat /proc/self/mounts
rootfs / rootfs rw 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
udev /dev devtmpfs rw,relatime,size=10240k,nr_inodes=2042814,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=1636228k,mode=755 0 0
/dev/disk/by-uuid/a48af464-6f1a-4e64-b2e1-57099ef44ab2 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
tmpfs /run/shm tmpfs rw,nosuid,nodev,noexec,relatime,size=5368160k 0 0
fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
/dev/sda2 /home ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0
cgroup /dev/cgroup/cpu cgroup rw,relatime,cpu,release_agent=/usr/local/sbin/cgroup_clean 0 0
i'm assuming that conky can't read symlinks; if it's so you need to point it to /proc/self/mounts
bliss of ignorance

Albert
Posts: 70
Joined: 16 Mar 2014 16:37

Re: conky script needs partition info

Postby Albert » 16 Mar 2014 22:51

Thank you again. I'll have to figure something else out. Conky has limited ability to manipulate/search strings. In systems with the old /etc/mtab the string I sought was something like "/dev/sda3", which was the first 9 characters. As you know, in later versions the first 9 characters returned by cat /etc/mtab are "rootfs / "
Again, thank you for your help.

BTW, as founder of SolydXK are you no longer with Mint? I really like this distro. Congratulations on a fine product.

User avatar
zerozero
Posts: 5373
Joined: 10 Feb 2013 23:37
Location: West Midlands, England
Contact:

Re: conky script needs partition info

Postby zerozero » 17 Mar 2014 23:56

you probably have other options to display what you want;
i'm terribly rusty with conky nowadays but for example have you seen how we do it in the solydxk-conky package?

the relevant part of the conkyrc is

Code: Select all

${font Sans:size=10}
${color FFFFFF}${goto 25}${voffset 27}${cpu cpu0}%
${color 00BFFF}${goto 25}CPU
${color FFFFFF}${goto 50}${voffset 20}${memperc}%
${color 00BFFF}${goto 50}RAM
${color FFFFFF}${goto 75}${voffset 20}${fs_used_perc /}%
${color 00BFFF}${goto 75}Disk
# Switch 'BAT' for 'Swap', and 'battery_percent BAT0' for 'swapperc' if no battery is present (and vise versa)
${color FFFFFF}${goto 100}${voffset 20}${swapperc}%
${color 00BFFF}${goto 100}Swap
# Check netwerk device to use (replace the ETH placeholder with the active network device - check ifconfig)
${color FFFFFF}${goto 125}${voffset 20}${color FFFFFF}${downspeed wlan0}
${color FFFFFF}${goto 125}${color FFFFFF}${upspeed wlan0}
${color 00BFFF}${goto 125}Net
${voffset 40}
[of course that the goto's and the offsets are specifics for that layout but you have an idea]

===
Albert wrote:BTW, as founder of SolydXK are you no longer with Mint? I really like this distro. Congratulations on a fine product.
Thanks for the kind words 8-)
i literally have no time for Mint now (and that is a shame really); still keep the Mod position there and visit the Forum whenever i can.
bliss of ignorance


Return to “Newbie Questions”

Who is online

Users browsing this forum: No registered users and 4 guests