1832994 Members
2465 Online
110048 Solutions
New Discussion

Re: Rc start up scripts

 
Ken Banville_2
New Member

Rc start up scripts

I need to start up a sybase database engine when the system is rebooted. But I
do not want the engine started by root. Is there a way I can get the sybase
DBA ID to execute the rc script file in run level 3?
5 REPLIES 5
Evan Day_1
Frequent Advisor

Re: Rc start up scripts

I'm not familiar with how Sybase starts up, but I do something similar for
informix -

I have an RC script that does the following:

su - informix -c "oninit"

The rc script itself is run as root, but the 'su' command runs the oninit
command as the informix user and my engine comes up with the informix uid
rather than root.

If starting up sybase involves a complicated script that can't cleanly be
placed into an su command, you should be able to execute the script directly
from su.

I'm assuming you know how to create the startup scripts and place links in
/sbin/rc#.d as appropriate. If you need help with that, let me know.

HTH
-Evan
Gavin Kerr
New Member

Re: Rc start up scripts

A construct I use a lot is something like this

if [ "`whoami`" != "" ]
then
if [ "`whoami`" = "root" ]
then
su -c "$0 $*"
exit $?
fi
else
echo "Only wants to run `basename $0`"
fi

Hope it helps,
Gav
Deshpande Prashant
Honored Contributor

Re: Rc start up scripts

HI
Using
su - -c "command to start" in the startup script should take care of starting required processes/database by said user id.

Thanks.
Prashant.
Take it as it comes.
Rodney Hills
Honored Contributor

Re: Rc start up scripts

Create a short shell script under /sbin/init.d/startmydb.
Symbolic link it to /sbin/rc3.d/S999mydb.
Symbolic link it to /sbin/rc2.d/K001mydb also.
Be sure to follow the rules of "rc" scripts (have a start,stop test within the script).

In the start portion, use the recommendation by Mr Evans.

-- Rod H
There be dragons...
Magdi KAMAL
Respected Contributor

Re: Rc start up scripts

Hi Ken,

Using the command :

su - sybaseDbaUser -c "commad -option arg0 ...argn"

Magdi