Please help to corect Action script to search and shutdown oracle database

(imported topic written by SystemAdmin)

Hi All,

Please help me to correct my script, i used elseif but even if the statement is false it will still run the command. Thanks in advanced.

here is my script:

//find os and exist services

if {name of operating system contains “AIX”}

run shutdown -f

elseif {(name of operating system contains “Linux”)}

delete __createfile

delete /tmp/shutdownDW.sh

createfile until exit

#!/bin/sh

ORACLE_SID=ofsaprd

ORACLE_HOME=/DW/oracle/10.2.0.3

export ORACLE_SID

export ORACLE_HOME

DT=date '+%m%d%y%H%M'

$ORACLE_HOME/bin/sqlplus / as sysdba << EOF

spool /usr/home/oracle/log/shut_db.$DT.log

shutdown immediate

EOF

mv /DW/admin/ofsaprd/bdump/alert_ofsaprd.log /DW/admin/ofsaprd/bdump/alert_ofsaprd.$DT.log

/usr/home/oracle/start_10g.sh

exit

move __createfile /tmp/shutdownDW.sh

wait /bin/sh -C /tmp/shutdownDW.sh

run shutdown -h

elseif {name of operating system contains “Linux”}

run shutdown -h

elseif {(name of operating system contains “Win”) and exists (service name whose (it contains “oracleservicecasprod”) of services)}

wait net stop oracleservicecasprod

prefetch cas_db_shutdown_script.bat.tmp sha1:cd2f74d4c28132592778db37f90c2f46f45e04b2 size:487 http://ITG-BIGFIXSVR.mbtc.mgc.local:52311/Uploads/cd2f74d4c28132592778db37f90c2f46f45e04b2/cas_db_shutdown_script.bat.tmp

extract cas_db_shutdown_script.bat.tmp

wait “{pathname of system folder & “\cmd.exe”}” /Q /C “{(pathname of client folder of current site) & “__Download\cas_db_shutdown_script.bat”}”

run shutdown /s

elseif {(name of operating system contains “Win”) and exists (service name whose (it contains “oracleserviceilsprod”) of services)}

wait net stop oracleserviceilsprod

prefetch ils_db_shutdown_script.bat.tmp sha1:4d9c6a11c61a60eb04d3a0ec24a23596b737c96c size:624 http://ITG-BIGFIXSVR.mbtc.mgc.local:52311/Uploads/4d9c6a11c61a60eb04d3a0ec24a23596b737c96c/ils_db_shutdown_script.bat.tmp

extract ils_db_shutdown_script.bat.tmp

wait “{pathname of system folder & “\cmd.exe”}” /Q /C “{(pathname of client folder of current site) & “__Download\ils_db_shutdown_script.bat”}”

run shutdown /s

elseif {(name of operating system contains “Win”) and exists (service name whose (it contains “oracleconcimgrmetro”) of services)}

wait net stop oracleconcimgrmetro

wait net stop oracleconcimgrstsi

prefetch py_shutdown_db_bigfix.bat.tmp sha1:5780238b574b40766ba48e358d674153b175725d size:736 http://ITG-BIGFIXSVR.mbtc.mgc.local:52311/Uploads/5780238b574b40766ba48e358d674153b175725d/py_shutdown_db_bigfix.bat.tmp

extract py_shutdown_db_bigfix.bat.tmp

wait “{pathname of system folder & “\cmd.exe”}” /Q /C “{(pathname of client folder of current site) & “__Download\py_shutdown_db_bigfix.bat”}”

elseif {(name of operating system contains “Win”) and exists (service name whose (it contains “oracleservicesecs”) of services)}

prefetch shutdown_SMS.bat.tmp sha1:4610666661445d829b2ca62f0e8d853b6aa953b8 size:113 http://ITG-BIGFIXSVR.mbtc.mgc.local:52311/Uploads/4610666661445d829b2ca62f0e8d853b6aa953b8/shutdown_SMS.bat.tmp

extract shutdown_SMS.bat.tmp

wait “{pathname of system folder & “\cmd.exe”}” /Q /C “{(pathname of client folder of current site) & “__Download\shutdown_SMS.bat”}”

run shutdown /s

elseif {(name of operating system contains “Win”) and exists (service name whose (it contains “oracleservicesopics21”) of services)}

wait net stop oracleservicesopics21

run shutdown /s

elseif {name of operating system contains “Win”}

run shutdown /s

endif

(imported comment written by SystemAdmin)

Hello Braid,

Maybe you can help clarify. if what statement is false?? What command is still running??

What do want to happen that is not happening?