Sponsored Content
Operating Systems Solaris How to set up legacy services right on Solaris 10 Post 302101812 by Tornado on Thursday 4th of January 2007 02:59:39 PM
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
 

8 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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
DH_SYSTEMD_START(1)						     Debhelper						       DH_SYSTEMD_START(1)

NAME
dh_systemd_start - start/stop/restart systemd unit files SYNOPSIS
dh_systemd_start [debhelperoptions] [--restart-after-upgrade] [--no-stop-on-upgrade] [unitfile...] DESCRIPTION
dh_systemd_start is a debhelper program that is responsible for starting/stopping or restarting systemd unit files in case no corresponding sysv init script is available. As with dh_installinit, the unit file is stopped before upgrades and started afterwards (unless --restart-after-upgrade is specified, in which case it will only be restarted after the upgrade). This logic is not used when there is a corresponding SysV init script because invoke-rc.d performs the stop/start/restart in that case. OPTIONS
--restart-after-upgrade Do not stop the unit file until after the package upgrade has been completed. This is the default behaviour in compat 10. In earlier compat levels the default was to stop the unit file in the prerm, and start it again in the postinst. This can be useful for daemons that should not have a possibly long downtime during upgrade. But you should make sure that the daemon will not get confused by the package being upgraded while it's running before using this option. --no-restart-after-upgrade Undo a previous --restart-after-upgrade (or the default of compat 10). If no other options are given, this will cause the service to be stopped in the prerm script and started again in the postinst script. -r, --no-stop-on-upgrade, --no-restart-on-upgrade Do not stop service on upgrade. --no-start Do not start the unit file after upgrades and after initial installation (the latter is only relevant for services without a corresponding init script). NOTES
Note that this command is not idempotent. dh_prep(1) should be called between invocations of this command (with the same arguments). Otherwise, it may cause multiple instances of the same text to be added to maintainer scripts. Note that dh_systemd_start should be run after dh_installinit so that it can detect corresponding SysV init scripts. The default sequence in dh does the right thing, this note is only relevant when you are calling dh_systemd_start manually. SEE ALSO
debhelper(7) AUTHORS
pkg-systemd-maintainers@lists.alioth.debian.org 11.1.6ubuntu2 2018-05-10 DH_SYSTEMD_START(1)
All times are GMT -4. The time now is 11:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy