Sponsored Content
Top Forums Shell Programming and Scripting I need help with a dbora, Oracle startup script Post 302984563 by gandolf989 on Thursday 27th of October 2016 09:46:14 AM
Old 10-27-2016
I need help with a dbora, Oracle startup script

I have the following script, /etc/init.d/dbora, and it is working on several servers but its
not working on one of the servers. I would like to add logging, but the exec redirects that
I had previously added did not work. The log file was not created. I put the log file under
/home/oracle/scripts/log. Since boot should run as root, I would not think that this is a
problem. But maybe it is. Any advice would be appreciated. Thanks.

Code:
exec >${STARTUP_LOGFILE}
exec 2>&1
...
exec 1>&-
exec 2>&-

Code:
#!/bin/sh
# chkconfig: 345 99 01
# description: dbora script start or stop database when the server startsup or shutsdown
set -x
export DBORA_ACTION=${1}
echo ">>> dbora running with ${DBORA_ACTION} parameter<<<" 1>&2
RETVAL=0

ORA_OWNER=oracle
export ORA_OWNER

case "${DBORA_ACTION}" in
    'start')
        # Start the Oracle databases:
        # The following command assumes that the oracle login
        # will not prompt the user for any values
        # Remove "&" if you don't want startup as a background process.
        su ${ORA_OWNER} -c "/home/oracle/scripts/bin/startup_all_dbs.sh" &
        touch /var/lock/subsys/dbora 1>&2
        echo "database startup script launched" 1>&2
        ;;
    'stop')
        # Stop the Oracle databases:
        # The following command assumes that the oracle login
        # will not prompt the user for any values
        su ${ORA_OWNER} -c "/home/oracle/scripts/bin/shutdown_all_dbs.sh"
        rm -vf /var/lock/subsys/dbora 1>&2
        echo "database shutdown script launched" 1>&2
        RETVAL=1
        ;;
    '*')
        echo "Usage: $0 {start|stop}"
        exit 1
esac

exit $RETVAL

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Startup script DSL

Hi, I'm using Damn Small Linux 2.3, could you tell me which script starts up the browser when fluxbox loads? Thanks C19 (0 Replies)
Discussion started by: c19h28O2
0 Replies

2. Shell Programming and Scripting

Startup script

New in Unix, I am adding a line "route add 57.14.y.y 57.14.x.x" every day after rebooting the system. Where can I add the line so during boot up (the system is re-started every day by design (???) the line is executed? (I tried the /etc/rc2.d/S90 but for some reason the line needs to be added... (2 Replies)
Discussion started by: texaspanama
2 Replies

3. Shell Programming and Scripting

how to take input at the startup script!!

Hi all, I am trying to modify a startup script... The problem is that i am unable to figure out how to take inputs from the user at the startup screen and proceed with the processing accordingly... Eg: $ echo "this is a test" (typically this would produce the output)... $ echo "this is a... (6 Replies)
Discussion started by: wrapster
6 Replies

4. UNIX for Dummies Questions & Answers

Startup Script Somewhere ?

Hello there! I need help. Everytime I login to my ssh, i see this: -bash: .export: command not found -bash: .export: command not found -bash: .export: command not found -bash: .export: command not found any help ? thanks (0 Replies)
Discussion started by: fbauto1
0 Replies

5. UNIX for Dummies Questions & Answers

run a script at startup

hi, i am using rhel 5, and i wanna run a script as soon as the operating system open. How can i do this ? ( i was reading rc.d files but i could not understand exactly what are the run levels and where should i put the my shell script. my script will be : #!/bin/ksh iptables -I INPUT... (1 Reply)
Discussion started by: futi
1 Replies

6. Solaris

oracle and weblogic startup

Hi All, i am facing problem after restart my Unix Box PC i should to startup oracle manual and weblogic also how yo make it start automatic (1 Reply)
Discussion started by: xxmasrawy
1 Replies

7. AIX

startup script

Hi I need the below script to be started whenever I reboot my aix server ? #cat cdbegin /cdirect/cdunix/ndm/bin/cdpmgr -i /cdirect/cdunix/ndm/cfg/cbspsdb01/initparm.cfg Please suggest how to add this to the startup ? (2 Replies)
Discussion started by: samsungsamsung
2 Replies

8. Shell Programming and Scripting

Apache tomcat startup script not booting at startup.

I copied the script from an AskUbuntu post - #!/bin/bash ### BEGIN INIT INFO # Provides: tomcat7 # Required-Start: $network # Required-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/Stop Tomcat server ### END INIT INFO ... (14 Replies)
Discussion started by: Hijanoqu
14 Replies

9. Shell Programming and Scripting

Startup script

I can't quite find a clear answer on how to properly write a start up script. Does anybody have any ideas?? (3 Replies)
Discussion started by: Huitzilopochtli
3 Replies
SERVICE(8)						      System Manager's Manual							SERVICE(8)

NAME
service - run a System V init script SYNOPSIS
service SCRIPT COMMAND [OPTIONS] service --status-all service --help | -h | --version DESCRIPTION
service runs a System V init script or systemd unit in as predictable an environment as possible, removing most environment variables and with the current working directory set to /. The SCRIPT parameter specifies a System V init script, located in /etc/init.d/SCRIPT, or the name of a systemd unit. The existence of a systemd unit of the same name as a script in /etc/init.d will cause the unit to take precedence over the init.d script. The supported val- ues of COMMAND depend on the invoked script. service passes COMMAND and OPTIONS to the init script unmodified. For systemd units, start, stop, status, and reload are passed through to their systemctl/initctl equivalents. All scripts should support at least the start and stop commands. As a special case, if COMMAND is --full-restart, the script is run twice, first with the stop command, then with the start command. service --status-all runs all init scripts, in alphabetical order, with the status command. The status is [ + ] for running services, [ - ] for stopped services and [ ? ] for services without a status command. This option only calls status for sysvinit jobs. EXIT CODES
service calls the init script and returns the status returned by it. FILES
/etc/init.d The directory containing System V init scripts. /{lib,run,etc}/systemd/system The directories containing systemd units. ENVIRONMENT
LANG, LANGUAGE, LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES, LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEA- SUREMENT, LC_IDENTIFICATION, LC_ALL, TERM, PATH The only environment variables passed to the init scripts. SEE ALSO
/etc/init.d/skeleton update-rc.d(8) init(8) invoke-rc.d(8) systemctl(1) AUTHOR
Miloslav Trmac <mitr@redhat.com>, Petter Reinholdtsen <pere@hungry.com> Licence: GNU Public Licence v2 (GPLv2) COPYRIGHT
2006 Red Hat, Inc., Petter Reinholdtsen <pere@hungry.com> Jan 206 SERVICE(8)
All times are GMT -4. The time now is 08:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy