You are not logged in.

#1 2009-04-07 11:35:41

EvasiveFR
Member
Registered: 2009-04-07
Posts: 35

Use hddtemp as user in my conky (permission right help)

Hello smile
I've just installed conky, lm_sensors, and hddtemp on my desktop smile

lm_sensors seems to work nicely, because I see the good temperature reports in my conky.

hddtemp gives me the temperature when I type "hddtemp /dev/sda" in terminal when I'm root.
But when i'm user, it's appears: "/dev/sda: open: Permission denied"

So in my conky, I can't see the hddtemp because conky is started as user right privileges.

Can you give me a proper solution ?

- My user is in the "storage" group.
- I don't want to start conky with root privileges...

Thanks !


Sorry for my english... I'm a french user !
If you don't understand what I say, just ask me ^^

Offline

#2 2009-04-07 13:29:27

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Use hddtemp as user in my conky (permission right help)

not sure if it's correct, but i just put the hddtemp command in my sudoers file with the NOPASSWD option.  (google or wiki sudo, visudo, or sudoers).  then i can sudo hddtemp in scripts and conky w/ no password needed or permission denied.

Offline

#3 2009-04-07 19:32:49

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,444
Website

Re: Use hddtemp as user in my conky (permission right help)

I use hddtemp in daemon mode and query it in my .conkyrc via the nc command:

sda:$color ${execi 300 nc localhost 7634 | cut -c50-51} C${color grey}  sdb:$color ${execi 300 nc localhost 7634 | cut -c50-51} C

Here is my .conkyrc in its entirety:

# for this to work you need both lm-sensors and hddtemp

# set to yes if you want Conky to be forked in the background
background no

#cpu_avg_samples 2
#net_avg_samples 2

own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

out_to_console no

# X font when Xft is disabled, you can pick one with program xfontsel
#font 7x12
#font 6x10
#font 7x13
#font 8x13
#font 7x12
#font *mintsmild.se*
#font -*-*-*-*-*-*-34-*-*-*-*-*-*-*
#font -artwiz-snap-normal-r-normal-*-*-100-*-*-p-*-iso8859-1

# Use Xft?
use_xft yes

# Xft font when Xft is enabled
xftfont Bitstream Vera Sans Mono:size=8

#own_window_transparent no
#own_window_colour hotpink
# Text alpha when using Xft
xftalpha 0.8

on_bottom yes

# Update interval in seconds
update_interval 2
# Create own window instead of using desktop (required in nautilus)
#own_window no

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
#minimum_size 250 5
maximum_width 258

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 10

# border margins
border_margin 4

# border width
border_width 1

# Default colors and also border colors
default_color white
default_shade_color white
default_outline_color white

# Text alignment, other possible values are commented
#alignment top_left
#minimum_size 10 10
#alignment top_right
alignment bottom_left
#alignment bottom_right

# Gap between borders of screen and text
gap_x 12
gap_y 37
# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer no

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

TEXT
${color #ddaa00}$nodename$color
$sysname $kernel on $machine
${color lightgrey}Uptime:$color $uptime ${color lightgrey}- Load:$color $loadavg${color lightgrey}
RAM Usage:$color $memperc% or $mem of $memmax${color lightgrey}
Swap Usage:$color $swapperc%${color lightgrey}
$color$stippled_hr${color lightgrey}
Intel Xeon X3360 @ $color${freq_g} GHz${color lightgrey}
Average CPU History:
${color black}${cpugraph 000000 5000a0}${color lightgrey}
 ${color lightgrey}Core0:$color ${execi 8 sensors | grep -A 1 'Core 0' | cut -c15-16 | sed '/^$/d'} C${color grey} @$color ${cpu cpu1}%   ${alignr}${cpubar cpu1 6,120}
 ${color lightgrey}Core1:$color ${execi 8 sensors | grep -A 1 'Core 1' | cut -c15-16 | sed '/^$/d'} C${color grey} @$color ${cpu cpu2}%   ${alignr}${cpubar cpu2 6,120}
 ${color lightgrey}Core2:$color ${execi 8 sensors | grep -A 1 'Core 2' | cut -c15-16 | sed '/^$/d'} C${color grey} @$color ${cpu cpu3}%   ${alignr}${cpubar cpu3 6,120}
 ${color lightgrey}Core3:$color ${execi 8 sensors | grep -A 1 'Core 3' | cut -c15-16 | sed '/^$/d'} C${color grey} @$color ${cpu cpu4}%   ${alignr}${cpubar cpu4 6,120}${color grey}
$color$stippled_hr${color lightgrey}
Thermal Monitors:${color lightgrey}
${alignr}GPU:$color ${execi 8 nvclock -T | grep 'GPU t' | cut -c21-22} C${color grey}  MB:$color ${execi 8 sensors | grep temp3 | cut -c15-16} C${color grey}  sda:$color ${execi 300 nc localhost 7634 | cut -c50-51} C${color grey}  sdb:$color ${execi 300 nc localhost 7634 | cut -c50-51} C${color grey}
$stippled_hr${color light grey}
${color lightgrey}Processes:$color $processes  ${color grey}Running:$color $running_processes
${color}Name              PID     CPU%   MEM%
${color #ddaa00} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color}Mem usage
${color #ddaa00} ${top_mem name 1} ${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
${color lightgrey} ${top_mem name 2} ${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
${color lightgrey} ${top_mem name 3} ${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}

CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2009-04-07 21:29:52

EvasiveFR
Member
Registered: 2009-04-07
Posts: 35

Re: Use hddtemp as user in my conky (permission right help)

@graysk:

nc = ncurse ?
Where do you specify the destination of your drive ? (I've not seen /dev/sda, /dev/hda...)


Sorry for my english... I'm a french user !
If you don't understand what I say, just ask me ^^

Offline

#5 2009-04-08 07:39:31

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,444
Website

Re: Use hddtemp as user in my conky (permission right help)

$ man nc
NC(1)                                                                                  NC(1)

NAME
       nc - TCP/IP swiss army knife

You need to be running hddtemp in daemon mode which will dump the data for all your drives.  I'm not doing it on arch, but my ubuntu box does it (as I recall I was prompted to do so when I installed it).  I don't know if pacman -S hddtemp will make a deamon or not.  The default port is 7634 so try:

$nc localhost 7634
|/dev/sg1|ST3640323AS|30|C||/dev/sg2|ST3640323AS|29|C||/dev/sg3|WDC WD7501AALS-00J7B0|35|C||/dev/sda|ST3640323AS|30|C||/dev/sdb|ST3640323AS|29|C||/dev/sdc|WDC WD7501AALS-00J7B0|35|C|

If it answers, you're running it.  Now you just need to parse out the data you want as I have done w/ grep and cut in the .conkyrc I posted.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#6 2009-04-08 09:49:52

The_Major
Member
From: Newport, UK
Registered: 2008-03-31
Posts: 18

Re: Use hddtemp as user in my conky (permission right help)

On arch you can run hddtemp as a daemon by running hddtemp -d /dev/sda I do this at startup and then have ${hddtemp sdb} in my conky, it works (I have also added hddtemp no password for my user to my sudoers file, don't know if this makes a difference, I did this before I discovered the other thning.)

Mark


Who Knows? Who Cares? Who will remember anyway?

Offline

#7 2009-04-14 19:15:47

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,444
Website

Re: Use hddtemp as user in my conky (permission right help)

Great idea!

1) visudo and add the following line:

%users  ALL=NOPASSWD: /usr/sbin/hddtemp

(install sudo if you don't have it).

2) My .conkyrc line for hdd temps is simply:

${color grey} sda:$color ${execi 300 sudo hddtemp /dev/sda | cut -c24-25} °C    ${color grey} sdb:$color ${execi 30vi0 sudo hddtemp /dev/sdb | cut -c24-25} °C    ${color grey} sdc:$color ${execi 300 sudo hddtemp /dev/sdc | cut -c24-25} °C

Last edited by graysky (2009-04-14 19:16:58)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#8 2009-11-12 00:02:16

soul..
Member
Registered: 2008-01-10
Posts: 10

Re: Use hddtemp as user in my conky (permission right help)

Hi,

simply set UID on hdtemp. And i think u need to create link to /usr/bin/.
Thats all, i hope this isnt wery dangerous..

Last edited by soul.. (2009-11-12 09:57:20)

Offline

Board footer

Powered by FluxBB