Title: Linux question Post by: max in montreal on September 13, 2011, 01:25:48 PM i created an executable file on my desktop and this is it:
Code: AMDOverdriveCtrl -i0 & 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... Title: Re: Linux question Post by: grondilu on September 13, 2011, 01:40:20 PM i created an executable file on my desktop and this is it: Code: AMDOverdriveCtrl -i0 & 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? Title: Re: Linux question Post by: max in montreal on September 13, 2011, 01:43:37 PM no, i do not know what that is...I am using linuxcoin.
Title: Re: Linux question Post by: grondilu on September 13, 2011, 01:46:54 PM no, i do not know what that is...I am using linuxcoin. The shebang (http://en.wikipedia.org/wiki/Shebang_%28Unix%29) 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. Title: Re: Linux question Post by: max in montreal on 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. Title: Re: Linux question Post by: ovidiusoft on September 13, 2011, 02:42:58 PM Try with this:
Code: #!/bin/sh Make sure that the file is executable. Also make sure when you copy/paste the text to keep the backticks ` around whoami. Title: Re: Linux question Post by: grondilu on 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 Title: Re: Linux question Post by: max in montreal on 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.
Title: Re: Linux question Post by: grondilu on 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. Title: Re: Linux question Post by: max in montreal on September 13, 2011, 03:13:21 PM Try with this: Code: #!/bin/sh 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... Title: Re: Linux question Post by: max in montreal on September 13, 2011, 03:18:59 PM Code: #!/bin/sh 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? Title: Re: Linux question Post by: drgr33n on September 13, 2011, 03:32:14 PM Code: #!/bin/sh 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 :D Sudo is your friend :D 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 Title: Re: Linux question Post by: max in montreal on September 13, 2011, 04:03:32 PM PERFECT!
|