Bitcoin Forum
May 04, 2024, 06:47:16 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Linux question  (Read 1159 times)
max in montreal (OP)
Hero Member
*****
Offline Offline

Activity: 504
Merit: 500


View Profile
September 13, 2011, 01:25:48 PM
 #1

i created an executable file on my desktop and this is it:

Code:
AMDOverdriveCtrl -i0 &
AMDOverdriveCtrl -i3 &
AMDOverdriveCtrl -i4 &
AMDOverdriveCtrl -i7 &
AMDOverdriveCtrl -i8 &
AMDOverdriveCtrl -i11 &
AMDOverdriveCtrl -i14 &

When I run it all starts fine without a problem, but my fans are not set. If I cut and paste this into a root terminal, all is perfect. What is the difference and why does it not run the same way? The problem is the fan ctrlis not enabled, but it is enabled when i paste it into root terminal...

1714848436
Hero Member
*
Offline Offline

Posts: 1714848436

View Profile Personal Message (Offline)

Ignore
1714848436
Reply with quote  #2

1714848436
Report to moderator
1714848436
Hero Member
*
Offline Offline

Posts: 1714848436

View Profile Personal Message (Offline)

Ignore
1714848436
Reply with quote  #2

1714848436
Report to moderator
1714848436
Hero Member
*
Offline Offline

Posts: 1714848436

View Profile Personal Message (Offline)

Ignore
1714848436
Reply with quote  #2

1714848436
Report to moderator
Activity + Trust + Earned Merit == The Most Recognized Users on Bitcointalk
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714848436
Hero Member
*
Offline Offline

Posts: 1714848436

View Profile Personal Message (Offline)

Ignore
1714848436
Reply with quote  #2

1714848436
Report to moderator
1714848436
Hero Member
*
Offline Offline

Posts: 1714848436

View Profile Personal Message (Offline)

Ignore
1714848436
Reply with quote  #2

1714848436
Report to moderator
1714848436
Hero Member
*
Offline Offline

Posts: 1714848436

View Profile Personal Message (Offline)

Ignore
1714848436
Reply with quote  #2

1714848436
Report to moderator
grondilu
Legendary
*
Offline Offline

Activity: 1288
Merit: 1076


View Profile
September 13, 2011, 01:40:20 PM
 #2

i created an executable file on my desktop and this is it:

Code:
AMDOverdriveCtrl -i0 &
AMDOverdriveCtrl -i3 &
AMDOverdriveCtrl -i4 &
AMDOverdriveCtrl -i7 &
AMDOverdriveCtrl -i8 &
AMDOverdriveCtrl -i11 &
AMDOverdriveCtrl -i14 &

When I run it all starts fine without a problem, but my fans are not set. If I cut and paste this into a root terminal, all is perfect. What is the difference and why does it not run the same way? The problem is the fan ctrlis not enabled, but it is enabled when i paste it into root terminal...

You have a shebang, right?

max in montreal (OP)
Hero Member
*****
Offline Offline

Activity: 504
Merit: 500


View Profile
September 13, 2011, 01:43:37 PM
 #3

no, i do not know what that is...I am using linuxcoin.
grondilu
Legendary
*
Offline Offline

Activity: 1288
Merit: 1076


View Profile
September 13, 2011, 01:46:54 PM
 #4

no, i do not know what that is...I am using linuxcoin.

The shebang is the first special comment line that tells what program to use.  In your case, it is probably:

Code:
#!/bin/sh

See what shell you use when you say that it's perfect when you copy/paste in your terminal.

If your code needs to run as a super-user, you might have to setuid root or something.

max in montreal (OP)
Hero Member
*****
Offline Offline

Activity: 504
Merit: 500


View Profile
September 13, 2011, 01:59:34 PM
 #5

if i add that line to the top and run it, nothing changes, it starts but the fan ctrl is still not set.

I am a linux newbie, and dont really know what else to do.
ovidiusoft
Sr. Member
****
Offline Offline

Activity: 252
Merit: 250


View Profile
September 13, 2011, 02:42:58 PM
 #6

Try with this:

Code:
#!/bin/sh

ME=`whoami`

if [ "$ME" = "root" ]; then
    AMDOverdriveCtrl -i0 &
    AMDOverdriveCtrl -i3 &
    AMDOverdriveCtrl -i4 &
    AMDOverdriveCtrl -i7 &
    AMDOverdriveCtrl -i8 &
    AMDOverdriveCtrl -i11 &
    AMDOverdriveCtrl -i14 &
else
    sudo $0
fi

Make sure that the file is executable. Also make sure when you copy/paste the text to keep the backticks ` around whoami.
grondilu
Legendary
*
Offline Offline

Activity: 1288
Merit: 1076


View Profile
September 13, 2011, 02:45:37 PM
 #7

if i add that line to the top and run it, nothing changes, it starts but the fan ctrl is still not set.

When it runs without the fan, is it running as a superuser?   If not, then I guess you need whether to setuid root (or something like that, I don't know exactly), or to give the user the necessary group privilege to control the fan (though I have no idea how).

To setuid root, you need to read the chmod man page.

I think that you must run something like:

$ setuid u+s yourscript
$ chown root yourscript




max in montreal (OP)
Hero Member
*****
Offline Offline

Activity: 504
Merit: 500


View Profile
September 13, 2011, 03:06:05 PM
 #8

i start root terminal and paste everything into there and it works, so i think i am running it as root.
grondilu
Legendary
*
Offline Offline

Activity: 1288
Merit: 1076


View Profile
September 13, 2011, 03:08:47 PM
 #9

i start root terminal and paste everything into there and it works, so i think i am running it as root.

So you definitely need to have you script file be run as root.   You can use the sudo command as ovidiusoft suggested, or you can chmod u+s yourfile.   It's up to you.   Configuring sudo to run a command without entering a password should be done carefully for obvious security reasons, though.

max in montreal (OP)
Hero Member
*****
Offline Offline

Activity: 504
Merit: 500


View Profile
September 13, 2011, 03:13:21 PM
 #10

Try with this:

Code:
#!/bin/sh

ME=`whoami`

if [ "$ME" = "root" ]; then
    AMDOverdriveCtrl -i0 &
    AMDOverdriveCtrl -i3 &
    AMDOverdriveCtrl -i4 &
    AMDOverdriveCtrl -i7 &
    AMDOverdriveCtrl -i8 &
    AMDOverdriveCtrl -i11 &
    AMDOverdriveCtrl -i14 &
else
    sudo $0
fi

Make sure that the file is executable. Also make sure when you copy/paste the text to keep the backticks ` around whoami.

perfect...now I need to add 2 more lines, change the directory and then run my miner...
max in montreal (OP)
Hero Member
*****
Offline Offline

Activity: 504
Merit: 500


View Profile
September 13, 2011, 03:18:59 PM
 #11

Code:
#!/bin/sh

ME=`whoami`

if [ "$ME" = "root" ]; then
    AMDOverdriveCtrl -i0 &
    AMDOverdriveCtrl -i3 &
    AMDOverdriveCtrl -i4 &
    AMDOverdriveCtrl -i7 &
    AMDOverdriveCtrl -i8 &
    AMDOverdriveCtrl -i11 &
    AMDOverdriveCtrl -i14 &
    cd /home/user/max &
    java -jar max.jar &
else
    sudo $0
fi

  cd /home/user/max &
    java -jar max.jar &

these 2 lines should be run in a terminal window, how would I get this to work?
drgr33n
Sr. Member
****
Offline Offline

Activity: 308
Merit: 251



View Profile
September 13, 2011, 03:32:14 PM
 #12

Code:
#!/bin/sh

ME=`whoami`

if [ "$ME" = "root" ]; then
    AMDOverdriveCtrl -i0 &
    AMDOverdriveCtrl -i3 &
    AMDOverdriveCtrl -i4 &
    AMDOverdriveCtrl -i7 &
    AMDOverdriveCtrl -i8 &
    AMDOverdriveCtrl -i11 &
    AMDOverdriveCtrl -i14 &
    cd /home/user/max &
    java -jar max.jar &
else
    sudo $0
fi

  cd /home/user/max &
    java -jar max.jar &

these 2 lines should be run in a terminal window, how would I get this to work?

EDIT: added lxterminal for a pop up screen Cheesy

Sudo is your friend Cheesy And we can make this a lot smaller !! Also I always use bash instead of sh. Just the way I learned things.

Code:
#!/bin/bash

for i in 0 3 4 7 8 11 14; do
 sudo AMDOverdriveCtrl -i$i &
done
cd /home/user/max
lxterminal -e "java -jar max.jar" &
max in montreal (OP)
Hero Member
*****
Offline Offline

Activity: 504
Merit: 500


View Profile
September 13, 2011, 04:03:32 PM
 #13

PERFECT!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!