LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 10-20-2004, 02:24 AM   #1
ngan_yine
Member
 
Registered: Aug 2003
Distribution: Slackware 10.1
Posts: 113

Rep: Reputation: 15
how to access /dev/hdx


Hi
I am having problem with my hddtemp program to read the hd temperature on my /dev/hdx as normal user.I could read temperature in root mod but in normal user mod it said that I don't permission .I try changing like chmod 755 /dev/hdx .It change into read exute mod but I still didn't have enought permissions as normal user to use it at all.


thanks for reading
arkar kyaw win
 
Old 10-20-2004, 02:40 AM   #2
rotvogel
Member
 
Registered: Oct 2003
Posts: 534

Rep: Reputation: 30
What you could do is to make the hddtemp program suid. In that case the program will be run as if it was executed by root.
 
Old 10-20-2004, 06:22 AM   #3
ngan_yine
Member
 
Registered: Aug 2003
Distribution: Slackware 10.1
Posts: 113

Original Poster
Rep: Reputation: 15
I actually thought about this too but I don't like the idea of any program suid-ing itself ,it make me a little bit creepy .It there no other way around?

Thanks

Arkar Kyaw Win
 
Old 10-20-2004, 06:40 AM   #4
malo_umoran
Member
 
Registered: Dec 2003
Distribution: Desktop: Slackware 13.1 &13.37 | Server: Debian 6.0
Posts: 270

Rep: Reputation: 32
I think that hddtemp will not run without root ...

put it in "/etc/rc.d/rc.local" ...

hddtemp -d /dev/hd[ab]

and that's it ...

M.
 
Old 10-21-2004, 11:09 AM   #5
ngan_yine
Member
 
Registered: Aug 2003
Distribution: Slackware 10.1
Posts: 113

Original Poster
Rep: Reputation: 15
I had just tried it that way , put /usr/local/sbin/hddtemp -n /dev/hdb in /etc/rc.d/rc.local .I just the program load but I still couldn't access as normal user.

thanks
Arkar Kyaw win
 
Old 10-21-2004, 11:58 AM   #6
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 242Reputation: 242Reputation: 242
after load the deamon as root :
hddtemp -d /dev/hda

to communicate with it, try as regular user :
telnet localhost 7634
 
Old 10-22-2004, 12:32 AM   #7
ngan_yine
Member
 
Registered: Aug 2003
Distribution: Slackware 10.1
Posts: 113

Original Poster
Rep: Reputation: 15
Hi thanks for the info ;
I had try it the way you told me telenet localhost 7634 and I could read it
but I don't know how to export it in to superkaramba or other monitor .But when
I open gtk system monitor ,it show the hddtemp /hdb and everything work out ok!
thanks
arkar kyaw win
 
Old 10-22-2004, 04:22 AM   #8
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 242Reputation: 242Reputation: 242
You could do a little script, like this :

Code:
#!/usr/bin/perl

open HDDTEMP,"telnet localhost 7634 2>/dev/null|";

while(<HDDTEMP>){
        if(/\|/) {
                ($n,$dev,$model,$temp,$unit,$s) = split /\|/;

                # print device
                print "Device: $dev\n";

                # print drive model
                print "Model: $model\n";

                # print drive temperature
                print "Temperature: $temp$unit\n";
        }
}
close HDDTEMP;
save it, chmod x it and eventually remove/comment the things you don't want to display
Yes it do the same as hddtemp command line but it does not require root privilege to execute it, it requires that hddtemp is started as deamon though.

Last edited by Cedrik; 10-22-2004 at 04:25 AM.
 
Old 10-22-2004, 08:28 AM   #9
ngan_yine
Member
 
Registered: Aug 2003
Distribution: Slackware 10.1
Posts: 113

Original Poster
Rep: Reputation: 15
Hi !

I really apperciate for the script.Now that I have the shell script it seem that I could insert my program into some karamba theme .Thanks man , It really mean a lot to me because I just re-compile my kernel to build i2c-chips into modules and I just found out after all that it didn't support the S.M.A.R.T hd heat sensors .Now it seem fine but the script only print out for one harddisk .I have two hd (hda and hdb) ,my linux box is on hdb.When I ran this command "telnet localhost 7634 2>/dev/null|" it sure did print out this line;
rying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
|/dev/hda|ST380011A|33|C||/dev/hdb|Maxtor 6E040L0|26|C|arkar@Ngan_yine:$
temp reading for both hd but when I run the script ,it show only one hd
arkar@Ngan_yine:$ ./hddtemp
Device: /dev/hda
Model: ST380011A
Temperature: 33C
I don't know anything about perl so I don't how to fix this loop or whatever the problem is ;
Can you please help me and fix it again please;


Thanks

Arkar Kyaw Win
 
Old 10-22-2004, 12:01 PM   #10
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 242Reputation: 242Reputation: 242
Not a prob Now the script should work with an unlimited drives number :

Code:
#!/usr/bin/perl

open HDDTEMP,"telnet localhost 7634 2>/dev/null|";

while(<HDDTEMP>){
    if(/\|/) {
        # this reg is just to help to split, remove first and last '|'
        $_ =~ s/^\|(.*)\|$/$1/;

        @drives = split /\|\|/;

        while(@drives) {
            $drive = shift @drives;
            ($dev,$model,$temp,$unit) = split /\|/, $drive;

            # print device
            print "Device: $dev\n";

            #print drive model
            print "Model: $model\n";

            #print $temperature
            print "Temperature: $temp$unit\n";

            # print new line for formating output
            print "\n";
        }
    }
}
close HDDTEMP;

Last edited by Cedrik; 10-22-2004 at 12:03 PM.
 
Old 10-22-2004, 04:23 PM   #11
ngan_yine
Member
 
Registered: Aug 2003
Distribution: Slackware 10.1
Posts: 113

Original Poster
Rep: Reputation: 15
wow! it work !it fit like a glove and it work like there is no tommorrow.Gee thanks a million man ,I am really obsess with this heat reading because I had already fix more than 15 capaciter in my motherboard.I had to replace it twice ,last time I had to replace 10 and before that I had to replace 5 at least .And my cpu over heat so much that I had to take off my case cover off
and cool it off with small fan .That not all 3 weeks ago ,overheating process kill my ageing seagate .I know I need to change my cpu heat seeker and case too ,if I want to install extra fan in
it .And my system power box is right up in my cpu heatseeker so I really have a bad configure case.So I am just waiting for christmax sale to shop around cheap and good.In the mean time I
am really dead serious about heating.
Thanks for the srcipt .it really help,I am a pascal progmmer(student) and I never thought perl could do a lot of thing .I am dumping pascal as soon as course is over.thanks for script!


Thanks!

arkar kyaw win
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I cannot access EITHER CD drive! And there's no /dev/hdc or /dev/hdd or /dev/cdrom! Dmalic Linux - Hardware 13 11-18-2005 07:11 PM
after recompiling the kernal, it complains that /dev/hdx do not exist! tagigogo Linux - Software 15 09-20-2004 10:10 AM
New kernel drivers Shifting /dev/hdx order omegaworks Linux - Hardware 1 09-06-2004 06:19 AM
I have overwritten /dev/fd0! How do I recreate /dev/fd0 to access my floppy? drscott1 Linux - Newbie 2 02-19-2004 12:37 PM
Installing off Slack cd (/dev/hdx...ect) Volcom Slackware 3 05-18-2003 01:40 PM


All times are GMT -5. The time now is 12:53 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration