Computing.Net > Forums > Unix > Creating Script to Shutdown/Startup

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Creating Script to Shutdown/Startup

Reply to Message Icon

Name: Deon
Date: June 7, 2007 at 06:15:49 Pacific
OS: AIX
CPU/Ram: Intel 4GB
Product: IBM
Comment:

Hi all
Can someone please help creating this script. These are the commands I do line for line then it works. But in a script is get stuck after the first line su - oracle at $.
I am a newbie to this please help.

su - oracle
lsnrctl start
export ORACLE_SID=WMSP
sss
startup
exit


export ORACLE_SID=WMSPA
sss
startup
exit
exit

su - forte
cd $FORTE_ROOT
./forteboot.sh
./bootEXE.sh
exit




Sponsored Link
Ads by Google

Response Number 1
Name: thepubba1
Date: June 7, 2007 at 11:42:53 Pacific
Reply:

If you are doing this as root, why don't you put all your commands and variables in a script and then use:

su -c oracle /path/myscript

The way your are trying to use su will not work in a batch shell script.


0

Response Number 2
Name: LukeChi
Date: June 7, 2007 at 12:15:55 Pacific
Reply:

Example #1:

su - oracle <<EOF
lsnrctl start
export ORACLE_SID=WMSP
sqlplus "/ as sysdba" <<EOFSQL
startup
EOFSQL
EOF

Example #2:

su - forte <<EOF
cd \$FORTE_ROOT
./forteboot.sh
./bootEXE.sh
EOF

Example #3:

#!/bin/ksh

su - oracle <<EOF
echo \$ORACLE_SID
sqlplus "/ as sysdba" <<EOFSQL
spool out.lst
select username from dba_users;
spool off
ls -l out.lst
!date
EOFSQL
EOF

Luke Chi


0

Response Number 3
Name: LukeChi
Date: June 7, 2007 at 12:18:25 Pacific
Reply:

In Example #3:

wrong:

...
ls -l out.lst
...

right:

...
!ls -l out.lst
...


Luke Chi


0

Response Number 4
Name: Deon
Date: June 8, 2007 at 01:13:12 Pacific
Reply:

Luke Chi

Thanks for the help.
I used the Examples as guidelines.
Was able to create a script to startup and another to shutdown in 15 min.

Thank You!!


0

Response Number 5
Name: LukeChi
Date: June 12, 2007 at 11:26:53 Pacific
Reply:

You're welcome

Luke Chi


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Creating Script to Shutdown/Startup

script to get the files created on recent sat www.computing.net/answers/unix/script-to-get-the-files-created-on-recent-sat/8422.html

Script to delete old files www.computing.net/answers/unix/script-to-delete-old-files/4094.html

Expect script to su and run passwd www.computing.net/answers/unix/expect-script-to-su-and-run-passwd/6154.html