max in montreal (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 13, 2011, 01:25:48 PM |
|
i created an executable file on my desktop and this is it: 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...
|
|
|
|
grondilu
Legendary
Offline
Activity: 1288
Merit: 1080
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 13, 2011, 01:40:20 PM |
|
i created an executable file on my desktop and this is it: 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)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 13, 2011, 01:43:37 PM |
|
no, i do not know what that is...I am using linuxcoin.
|
|
|
|
grondilu
Legendary
Offline
Activity: 1288
Merit: 1080
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 13, 2011, 01:46:54 PM |
|
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: 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)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 13, 2011, 01:59:34 PM |
|
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
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 13, 2011, 02:42:58 PM |
|
Try with this: #!/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
Activity: 1288
Merit: 1080
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 13, 2011, 02:45:37 PM |
|
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)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 13, 2011, 03:06:05 PM |
|
i start root terminal and paste everything into there and it works, so i think i am running it as root.
|
|
|
|
grondilu
Legendary
Offline
Activity: 1288
Merit: 1080
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 13, 2011, 03:08:47 PM |
|
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)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 13, 2011, 03:13:21 PM |
|
Try with this: #!/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)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 13, 2011, 03:18:59 PM |
|
#!/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
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 13, 2011, 03:32:14 PM |
|
#!/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](https://bitcointalk.org/Smileys/default/cheesy.gif) Sudo is your friend ![Cheesy](https://bitcointalk.org/Smileys/default/cheesy.gif) And we can make this a lot smaller !! Also I always use bash instead of sh. Just the way I learned things. #!/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" &
|
|
|
|
|
|