Looking for a good Linux project

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Originally posted by: LeonarD26
OK, so I've got the .sh scripts to run when the Linux box starts. I placed a link to it in the rc.local file which is in the /etc/rc.d directory. The only problem is, I need the script to run as a different user (seems to run as 'root', needs to be 'oracle'). Any ideas?

USER should be replaced by the username and COMMAND should be replaced by the command to be run. I will give you the answer, and then you will do some reading. Commands are in bold. ;)

su USER -c COMMAND

Now, after you try it out and report back, man su.
 

LeonarD26

Senior member
Feb 12, 2004
826
1
71
Thanks n0cmonkey. I modified the rc.local script. It looks something like this:

su oracle -c sh /directory/file.sh

I reboot the machine and the script tries to run, but I get the following error:

'no job control in this shell'

Any ideas? I have to comment out that line and then reboot for the box to come up completely. I did try to su the first time, but within the actual sh script the first time, and that didn't work either.

Thanks!
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Originally posted by: LeonarD26
Thanks n0cmonkey. I modified the rc.local script. It looks something like this:

su oracle -c sh /directory/file.sh

I reboot the machine and the script tries to run, but I get the following error:

'no job control in this shell'

Any ideas? I have to comment out that line and then reboot for the box to come up completely. I did try to su the first time, but within the actual sh script the first time, and that didn't work either.

Thanks!

Oracle needs a valid shell for this to work (/bin/bash, /bin/sh, etc). What shell is configured for Oracle (grep oracle /etc/passwd).
 

LeonarD26

Senior member
Feb 12, 2004
826
1
71
oracle:x:501:501::/home/oracle:/bin/bash

I've added the line '!/bin/bash' to the sh script, but I'm still getting the error. Any ideas?