How to set up legacy services right on Solaris 10


 
Thread Tools Search this Thread
Operating Systems Solaris How to set up legacy services right on Solaris 10
# 8  
Old 01-04-2007
grial:

Thanks a lot for the details. But I have some questions:

1. Do you mean I can chmod dbora to allow everyone to execute. Or you mean I need to chown dbora from root to oracle. The dbora is the control script, I have linked it from /etc/init.d to /etc/rc0.d and /etc/rc2.d as S99dbora. If I chmod S99dbora to be executed by oracle user, will that work?

2. Based on your code for wrapper script. I understand it is to use wrapper one to call control script-dbora. The dbora is under root. So I have to create this wrapper one as oracle user because #!/bin/ksh is korn shell for oracle. Am I right? Please clarify this for me. What does $1 represent for?


Quote:
Originally Posted by grial
That's, most probably, a perms issue. Just chmod it to allow execution to the Oracle user.

A wrapper script, in your case, would be another script that calls the original one using "su". That new script is the one you would use to start/stop Oracle during the boot process. For example:
Code:
#!/bin/ksh
/usr/bin/su - oracle -c "/etc/init.d/dbora $1"

# 9  
Old 01-04-2007
Quote:
Originally Posted by duke0001
1. Do you mean I can chmod dbora to allow everyone to execute. Or you mean I need to chown dbora from root to oracle. The dbora is the control script, I have linked it from /etc/init.d to /etc/rc0.d and /etc/rc2.d as S99dbora. If I chmod S99dbora to be executed by oracle user, will that work?
755 would be enough for /etc/init.d/dbora
No matter to what user it belongs with that perms.
Quote:
Originally Posted by duke0001
2. Based on your code for wrapper script. I understand it is to use wrapper one to call control script-dbora. The dbora is under root. So I have to create this wrapper one as oracle user because #!/bin/ksh is korn shell for oracle. Am I right? Please clarify this for me. What does $1 represent for?
Say you create the script I posted, and you call it calldbora.
Then this is the script you have to link to /etc/rc0.d and /etc/rc2.d (and delete the old ones).
$1 represets the first parameter passed to the script: start or stop Smilie
But try first the "su" comand to test it Smilie
# 10  
Old 01-04-2007
You can su in the script under the the start option in your case statement
All the rc scripts get run by the root user, so you don't need to chmod 755 your script. You don't need a wrapper and really shouldn't set it up like this, stick to the standard way of using rc boot up scripts, using a case statement with start/stop options.
Your rc start config is correct, its your script that is not working.

Here's a couple of old example oracle start scripts..

Installation instructions appear below each script
Code:
#!/sbin/sh
# Start/stop Oracle database(s) found in /var/opt/oracle/oratab
# NOTE that tns listener must start AFTER this script (S98tns start)
# and stop BEFORE (K20tns stop) this script.

case "$1" in
'start')
	su oracle -c "/oracle/app/oracle/product/8.1.6/bin/dbstart"
	;;
'stop')
	su oracle -c "/oracle/app/oracle/product/8.1.6/bin/dbshut"
	;;
*)
	echo "Usage: $0 { start | stop }"
	exit 1
	;;
esac
exit 0

Install this script as /etc/init.d/oracle then symlink it:

# link -s /etc/init.d/oracle /etc/rc2.d/S97oracle
# link -s /etc/init.d/oracle /etc/rc1.d/K21oracle
# link -s /etc/init.d/oracle /etc/rc0.d/K21oracle
# link -s /etc/init.d/oracle /etc/rcS.d/K21oracle

Code:
#!/sbin/sh
# Start/stop Oracle TNS listener
# NOTE that TNS listener must start AFTER dbstart (S97oracle start)
# and stop BEFORE (K20oracle stop).

/bin/logger $0 $1

case "$1" in
'start')
	su oracle -c "/oracle/app/oracle/product/8.1.6/bin/tnsctl start"
	;;
'stop')
	su oracle -c "/oracle/app/oracle/product/8.1.6/bin/tnsctl stop"
	;;
*)
	echo "Usage: $0 { start | stop }"
	exit 1
	;;
esac
exit 0

Install this script as /etc/init.d/tns then symlink it:

# link -s /etc/init.d/tns /etc/rc3.d/S98tns
# link -s /etc/init.d/tns /etc/rc1.d/K20tns
# link -s /etc/init.d/tns /etc/rc0.d/K20tns
# link -s /etc/init.d/tns /etc/rcS.d/K20tns


Last edited by Tornado; 01-04-2007 at 04:06 PM..
Tornado
# 11  
Old 01-04-2007
Tornado, grial:

Many thanks to both of you for your informative advice. You are right. The problem might be in my script. I am going to find the time to implement your code. Hereafter, I post my dbora script for your comments. I put all start and stop commands in one script. Also, in my $ORACLE_HOME/bin/dbstart script, the ORATAB=/etc/oratab, not in /var/opt/oracle/oratab. I copy oratab from /etc to /var/opt/oracle. Is this OK or I have to modify the ORATAB path to point to /var/opt/oracle. Please advise too.

#!/bin/sh
ORA_HOME=/u01/app/oracleproduct/10.2.0/db_1
ORA_OWNER=oracle
if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo " Oracle startup: cannot start"
exit
fi
case "$1" in
'start') # Start the Oracle database and listeners
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart"
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl start dbconsole"
su - $ORA_OWNER -c "$ORA_HOME/bin/isqlplusctl start"
;;
'stop') # Stop the Oracle database and listeners
su - $ORA_OWNER -c "$ORA_HOME/bin/isqlplusctl stop"
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl stop dbconsole"
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut"
;;
esac

Last edited by duke0001; 01-04-2007 at 06:49 PM..
# 12  
Old 01-04-2007
Tornado, as you can read on my posts avobe, the script "dbora" is supposed to accept start/stop parameters. Assuming this, you don't need to use a "case" again inside the wrapper script. That's why just a "$1" is enough.

Yo DO need to set 555, at least, in the "dbora" script if you want to execute it as the Oracle user from the wrapper script. Obviously, you DO NOT need it on the wrapper script as long as it's executed by root.

Back to your script, duke0001, the problem seems to be that the file /u01/app/oracleproduct/10.2.0/db_1/bin/dbstart does not exist. Check it and, for now, forget everything about the wrapper script. Smilie
# 13  
Old 01-04-2007
grial:

/u01/app/oracle/product/10.2.0/db_1/bin/dbstart script do exist. I can manually execute it and I have tried a couple of times, it work perfectly. Thanks.
# 14  
Old 01-05-2007
mmm... that's a weird thing if, as you've posted, you are getting the message "Oracle startup: cannot start". That looks like failing on:
Code:
if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo " Oracle startup: cannot start"
exit
fi

Just remove this part if you are sure about /u01/app/oracle/product/10.2.0/db_1/bin
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Solaris

NIS/smtp services issue on Solaris 11

Hi, Few services not starting on new build Solaris 11 non-global zone. I uninstalled zone and reinstalled and still same issue, while global zone is working fine. smpt service is going into maintenance mode and /var/svc/log/network-smtp:sendmail.log shows that it tries and then dead ... (0 Replies)
Discussion started by: solaris_1977
0 Replies

2. Solaris

Solaris 10 alternate ways of starting legacy scripts

Scenario: I have installed a service. When I start it by running /etc/init.d/<service> start it generates a massive amount of audit data (auditd) in /var/audit. So much so that running the service for any length of time is inadvisable due to overhead. However if I reboot the system the... (6 Replies)
Discussion started by: penguinpanzer
6 Replies

3. Solaris

Legacy Ultra60 with Solaris 5.7 SCSI device reverse engineering

I'm looking for help with a legacy system. I have some obsolete equipment connected to an Ultra 60 running Solaris 5.7 with the binary for a 32 bit driver. The driver is rejected by newer versions of solaris, which run 64 bit kernels. I hope to reverse engineer the driver so that I can... (0 Replies)
Discussion started by: obsoleteStuff
0 Replies

4. Solaris

Solaris 10 Services - Audit and Closure

Hello We have recently been through an audit of our solaris servers. All our solaris servers are running version 10. We have been told to close down all the services and we have closed what we could by using svcadm disable We only wish to let ssh and the ftp service to run. Below is a... (3 Replies)
Discussion started by: sollyshah
3 Replies

5. Solaris

DNS Services on Solaris

We need a DNS Server on DNS 10. What the best product can i buy and install ? Help me, pls. Tks all. (1 Reply)
Discussion started by: quan0509
1 Replies

6. Solaris

Remote services during Solaris installation

I've installed Solaris 10 (05-08) on a SPARC platform During the installation I was prompted with the question below. I selected yes to enable remote services. Does anyone know what services this option enables? - Enabling remote services ---------------------------------------- Would... (6 Replies)
Discussion started by: soliberus
6 Replies

7. UNIX for Advanced & Expert Users

services, solaris 10

dear all, i have 2 questions on solaris 10. I noticed telnet/ftp/print services suddenly being stopped on one server. How can i trace this issue and find a resolution. Other issue is i need to enable rsh within the same host. enabled the service rexec and have created the .rhosts and have a + in... (4 Replies)
Discussion started by: earlysame55
4 Replies

8. Cybersecurity

Unix Services (Solaris 9)

Our systems group is asking if it would be Ok to turn off certain services due to potention security risks. The following are being contemplated. Service chargen daytime discard dtspcd echo exec finger fs gssd in.comsat kcms_server ktkt_warnd login name rpc.cmsd rpc.metad... (4 Replies)
Discussion started by: BCarlson
4 Replies
Login or Register to Ask a Question