Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:GA
orarun
refactor-su-with-wrapper.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File refactor-su-with-wrapper.patch of Package orarun
Index: b/oracle =================================================================== --- a/oracle +++ b/oracle @@ -208,6 +208,13 @@ ora_environment() fi } +uid_wrapper() +{ + local username="$1" + local command="$2" + + su - $username -c "$command" +} # Here we finally get to do the real work. case "$1" in @@ -469,7 +476,7 @@ case "$1" in echo -n " - Starting Listener..." if [ "${START_ORACLE_DB_LISTENER:-no}" = "yes" ]; then - su - $ORACLE_OWNER -c "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/lsnrctl start > /dev/null" + uid_wrapper $ORACLE_OWNER "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/lsnrctl start > /dev/null" rc_status -v -r else if [ ${START_ORACLE_DB_LISTENER:-no} = "cannot" ]; then @@ -485,7 +492,7 @@ case "$1" in echo " + Starting Database(s)..." if [ "${START_ORACLE_DB:-no}" = "yes" ]; then # Fix log directories: 9iR2 RAC installation forgets these directories on the nodes - su - $ORACLE_OWNER -c "$MKDIR -p $ORACLE_HOME/rdbms/audit $ORACLE_HOME/rdbms/log $ORACLE_HOME/network/log 2>/dev/null" + uid_wrapper $ORACLE_OWNER "$MKDIR -p $ORACLE_HOME/rdbms/audit $ORACLE_HOME/rdbms/log $ORACLE_HOME/network/log 2>/dev/null" # The database will not start if the entry in /etc/oratab is "N" cat /etc/oratab | while read LINE do @@ -520,9 +527,9 @@ case "$1" in # bz#353957 ORACLE_VERSION=`$ORACLE_HOME/bin/sqlplus -v | awk '{split($3, V, "."); print V[1]}'` if [ $ORACLE_VERSION = "11" ]; then - su - $ORACLE_OWNER -c "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/dbstart $ORACLE_HOME" + uid_wrapper $ORACLE_OWNER "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/dbstart $ORACLE_HOME" else - su - $ORACLE_OWNER -c "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/dbstart" + uid_wrapper $ORACLE_OWNER "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/dbstart" fi rc_status echo -n " Status of Oracle database(s) start:" @@ -560,7 +567,7 @@ case "$1" in echo -n " - Starting Application Server..." if [ "${START_ORACLE_AS_ALL:-no}" = "yes" ]; then - su - $ORACLE_OWNER -c "export ORACLE_HOME=$ORACLE_HOME; $ORACLE_HOME/opmn/bin/opmnctl startall > /dev/null" + uid_wrapper $ORACLE_OWNER "export ORACLE_HOME=$ORACLE_HOME; $ORACLE_HOME/opmn/bin/opmnctl startall > /dev/null" if [ "$?" != "0" ]; then rc_failed; else rc_failed 0; fi rc_status -v -r else @@ -576,7 +583,7 @@ case "$1" in echo -n " - Starting Application Server Console..." if [ "${START_ORACLE_AS_CONSOLE:-no}" = "yes" ]; then - su - $ORACLE_OWNER -c "export ORACLE_HOME=$ORACLE_HOME; $ORACLE_HOME/bin/emctl start iasconsole > /dev/null" + uid_wrapper $ORACLE_OWNER "export ORACLE_HOME=$ORACLE_HOME; $ORACLE_HOME/bin/emctl start iasconsole > /dev/null" if [ "$?" != "0" ]; then rc_failed; else rc_failed 0; fi rc_status -v -r else @@ -591,7 +598,7 @@ case "$1" in echo -n " - Starting Agent..." if [ "${START_ORACLE_DB_AGENT:-no}" = "yes" ]; then - su - $ORACLE_OWNER -c "export ORACLE_HOME=$AGENT_HOME TNS_ADMIN=$TNS_ADMIN; $AGENT_START > /dev/null" + uid_wrapper $ORACLE_OWNER "export ORACLE_HOME=$AGENT_HOME TNS_ADMIN=$TNS_ADMIN; $AGENT_START > /dev/null" rc_status -v -r else if [ ${START_ORACLE_DB_AGENT:-no} = "cannot" ]; then @@ -609,7 +616,7 @@ case "$1" in for SID in `sed -n 's/^\([^#+]*\):.*:Y/\1/p' /etc/oratab` do echo -n " Starting DB Console for $SID" - su - $ORACLE_OWNER -c "export ORACLE_SID=$SID ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/emctl start dbconsole > /dev/null" < /dev/null & + uid_wrapper $ORACLE_OWNER "export ORACLE_SID=$SID ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/emctl start dbconsole > /dev/null" < /dev/null & sleep 5 done rc_status -v -r @@ -625,7 +632,7 @@ case "$1" in echo -n " - Starting iSQLPLUS Manager..." if [ "${START_ORACLE_DB_ISQLPLUS:-no}" = "yes" ]; then - su - $ORACLE_OWNER -c "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/isqlplusctl start > /dev/null" + uid_wrapper $ORACLE_OWNER "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/isqlplusctl start > /dev/null" rc_status -v -r else if [ ${START_ORACLE_DB_ISQLPLUS:-no} = "cannot" ]; then @@ -675,7 +682,7 @@ case "$1" in if [ "$ORACLE_RAC" = "yes" ]; then # TO DO - Find Better way to shutdown - # test -x $ORACLE_HOME/bin/emctl && test "${START_ORACLE_DB_EMANAGER:-no}" = "yes" && echo -n "Shutting down Enterprise Manager: " && (su - $ORACLE_OWNER -c "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/emctl stop dbconsole > /dev/null"; rc_status -v -r) + # test -x $ORACLE_HOME/bin/emctl && test "${START_ORACLE_DB_EMANAGER:-no}" = "yes" && echo -n "Shutting down Enterprise Manager: " && (uid_wrapper $ORACLE_OWNER "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/emctl stop dbconsole > /dev/null"; rc_status -v -r) # init.crs stop prints Shutting down message test -x /etc/init.d/init.crs && $CHECKPROC $ORA_CRS_HOME/bin/ocssd.bin && test "${START_ORACLE_RAC_CRS:-no}" = "yes" && echo -n && (/etc/init.d/init.crs stop; sleep 5; rc_status -v -r) @@ -689,16 +696,16 @@ case "$1" in if [ ${START_ORACLE_DB_AGENT:-no} = "yes" ]; then case $AGENT_VERSION in 10g) - test -x $AGENT_PROG && $CHECKPROC $AGENT_PROG && echo -n "Shutting down Agent: " && (su - $ORACLE_OWNER -c "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $AGENT_STOP > /dev/null"; rc_status -v -r) + test -x $AGENT_PROG && $CHECKPROC $AGENT_PROG && echo -n "Shutting down Agent: " && (uid_wrapper $ORACLE_OWNER "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $AGENT_STOP > /dev/null"; rc_status -v -r) ;; 10gA) - test -x $AGENT_PROG && $CHECKPROC $AGENT_PROG && echo -n "Shutting down Agent: " && (su - $ORACLE_OWNER -c "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $AGENT_STOP > /dev/null"; rc_status -v -r) + test -x $AGENT_PROG && $CHECKPROC $AGENT_PROG && echo -n "Shutting down Agent: " && (uid_wrapper $ORACLE_OWNER "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $AGENT_STOP > /dev/null"; rc_status -v -r) ;; 9i) - test -x $AGENT_PROG && $CHECKPROC $AGENT_PROG && echo -n "Shutting down Agent: " && (su - $ORACLE_OWNER -c "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $AGENT_STOP > /dev/null"; rc_status -v -r) + test -x $AGENT_PROG && $CHECKPROC $AGENT_PROG && echo -n "Shutting down Agent: " && (uid_wrapper $ORACLE_OWNER "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $AGENT_STOP > /dev/null"; rc_status -v -r) ;; 8i) - test -x $AGENT_PROG && $CHECKPROC $AGENT_PROG && echo -n "Shutting down Agent: " && (su - $ORACLE_OWNER -c "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $AGENT_STOP > /dev/null"; rc_status -v -r) + test -x $AGENT_PROG && $CHECKPROC $AGENT_PROG && echo -n "Shutting down Agent: " && (uid_wrapper $ORACLE_OWNER "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $AGENT_STOP > /dev/null"; rc_status -v -r) ;; *) echo "Oracle Agent undefinied or not properly set. Please check." @@ -706,13 +713,13 @@ case "$1" in esac fi - test -x $ORACLE_HOME/bin/isqlplusctl && test "${START_ORACLE_DB_ISQLPLUS:-no}" = "yes" && echo -n "Shutting down iSQLPLUS Manager: " && (su - $ORACLE_OWNER -c "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/isqlplusctl stop > /dev/null"; rc_status -v -r) + test -x $ORACLE_HOME/bin/isqlplusctl && test "${START_ORACLE_DB_ISQLPLUS:-no}" = "yes" && echo -n "Shutting down iSQLPLUS Manager: " && (uid_wrapper $ORACLE_OWNER "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/isqlplusctl stop > /dev/null"; rc_status -v -r) - test -x $ORACLE_HOME/bin/emctl && test "${START_ORACLE_DB_EMANAGER:-no}" = "yes" && echo -n "Shutting down Enterprise Manager: " && (su - $ORACLE_OWNER -c "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/emctl stop dbconsole > /dev/null"; rc_status -v -r) + test -x $ORACLE_HOME/bin/emctl && test "${START_ORACLE_DB_EMANAGER:-no}" = "yes" && echo -n "Shutting down Enterprise Manager: " && (uid_wrapper $ORACLE_OWNER "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/emctl stop dbconsole > /dev/null"; rc_status -v -r) - test -x $ORACLE_HOME/bin/lsnrctl && test "${START_ORACLE_DB_LISTENER:-no}" = "yes" && $CHECKPROC $ORACLE_HOME/bin/tnslsnr && echo -n "Shutting down Listener: " && (su - $ORACLE_OWNER -c "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/lsnrctl stop > /dev/null"; rc_status -v -r) + test -x $ORACLE_HOME/bin/lsnrctl && test "${START_ORACLE_DB_LISTENER:-no}" = "yes" && $CHECKPROC $ORACLE_HOME/bin/tnslsnr && echo -n "Shutting down Listener: " && (uid_wrapper $ORACLE_OWNER "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/lsnrctl stop > /dev/null"; rc_status -v -r) - test -x $ORACLE_HOME/bin/dbshut && test "${START_ORACLE_DB:-no}" = "yes" && $CHECKPROC $ORACLE_HOME/bin/oracle && echo -n "Shutting down Database: " && (su - $ORACLE_OWNER -c "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/dbshut > /dev/null"; rc_status -v -r) + test -x $ORACLE_HOME/bin/dbshut && test "${START_ORACLE_DB:-no}" = "yes" && $CHECKPROC $ORACLE_HOME/bin/oracle && echo -n "Shutting down Database: " && (uid_wrapper $ORACLE_OWNER "export ORACLE_HOME=$ORACLE_HOME TNS_ADMIN=$TNS_ADMIN; $ORACLE_HOME/bin/dbshut > /dev/null"; rc_status -v -r) # This case is for Single Instance Database using ASM storage (Not RAC) # for RAC init.crs will do this @@ -745,11 +752,11 @@ case "$1" in if [ "$ORACLE_RAC" = "yes" ]; then echo "${extd}OCFS2 Status$norm" - su - $ORACLE_OWNER -c "$LOAD_OCFS2 status" + uid_wrapper $ORACLE_OWNER "$LOAD_OCFS2 status" echo echo "${extd}Oracle Clusterware Status$norm" - $CHECKPROC $ORA_CRS_HOME/bin/ocssd.bin &&( su - $ORACLE_OWNER -c "$ORA_CRS_HOME/bin/crsctl check crs" ) + $CHECKPROC $ORA_CRS_HOME/bin/ocssd.bin &&( uid_wrapper $ORACLE_OWNER "$ORA_CRS_HOME/bin/crsctl check crs" ) echo fi @@ -770,7 +777,7 @@ case "$1" in IFS=: grep -v '^\(#\|$\)' /etc/oratab | while read sid ohome autostart ; do state=up - su - $ORACLE_OWNER -c "export ORACLE_SID=$sid; sqlplus /nolog" <<-! 2>/dev/null | grep ORA-01034 >/dev/null && state=down + uid_wrapper $ORACLE_OWNER "export ORACLE_SID=$sid; sqlplus /nolog" <<-! 2>/dev/null | grep ORA-01034 >/dev/null && state=down connect / as sysdba show sga ! @@ -780,7 +787,7 @@ show sga fi if [ -x $ORACLE_HOME/bin/lsnrctl ]; then state=up - su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl status" | grep "[nN]o [lL]istener" >/dev/null && state=down + uid_wrapper $ORACLE_OWNER "$ORACLE_HOME/bin/lsnrctl status" | grep "[nN]o [lL]istener" >/dev/null && state=down echo "${extd}TNS-Listener:$norm $state" echo fi @@ -793,7 +800,7 @@ show sga if [ -x $ORACLE_HOME/bin/agentctl ]; then state=up - su - $ORACLE_OWNER -c "agentctl status" | grep "Could not contact agent" >/dev/null && state=down + uid_wrapper $ORACLE_OWNER "agentctl status" | grep "Could not contact agent" >/dev/null && state=down echo "${extd}Intelligent Agent:$norm $state" echo fi
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor