Sponsored Content
Full Discussion: ssh in script
Top Forums UNIX for Dummies Questions & Answers ssh in script Post 41763 by mrbnetbar on Tuesday 14th of October 2003 03:43:25 AM
Old 10-14-2003
ssh in script

Hi ssh has now been set up to not prompt for a password. My problem is I have the script below that I wish.

Firstly ssh onto another box and then run the rest of the script problem I am not sure of the syntax.
Code:
#!/bin/ksh


. ${ENV}/oracle_env.ksh

****I WANT TO SSH AT THIS POINT AND CONTINUE WITH REMAINDER OF SCRIPT BELOW ****

DB_NAME=cidw2
TOTAL_RC=0

export TOTAL_RC DB_NAME 

# Shutdown ${DB_NAME} database on INDITF2 
echo "*********************** Bouncing the database ***************************"

ORACLE_SID=${DB_NAME}
export ORACLE_SID
EOF
sqlplus internal << EOF 
whenever sqlerror exit failure;
whenever oserror exit failure;
--ALTER SYSTEM ARCHIVE LOG CURRENT;
--ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
shutdown abort
exit
EOF

RC=$?
TOTAL_RC=`expr ${TOTAL_RC} + ${RC}`
export TOTAL_RC

rm $ORACLE_HOME/dbs/orapw${DB_NAME}
orapwd file=$ORACLE_HOME/dbs/orapw${DB_NAME} password=change_on_install entries=10

RC=$?
TOTAL_RC=`expr ${TOTAL_RC} + ${RC}`
export TOTAL_RC

sqlplus internal << EOF
whenever sqlerror exit failure;
whenever oserror exit failure;
startup nomount
exit
EOF


RC=$?
TOTAL_RC=`expr ${TOTAL_RC} + ${RC}`
export TOTAL_RC

if [ ${TOTAL_RC} -eq 0 ]
then
        echo "###################################################"
        echo "#####   Database ${DB_NAME} started nomount   #####"
        echo "###################################################"
        exit 0
else
        echo "#######################################################"
        echo "##### DATABASE ${DB_NAME} FAILED TO START NOMOUNT #####"
        echo "#######################################################"
        echo "CIDW2 STARTUP NOMOUNT FAILED" >> ${APP_TEMP}/error_check.log
        exit 1
fi

Thanks in advance

added code tags for readability --oombera

Last edited by oombera; 02-17-2004 at 04:27 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

ssh in a script

Hi, I am trying to ssh/rlogin onto another box through a script. What is the syntax so I do not get prompted for a password. Thanks in advance (3 Replies)
Discussion started by: mrbnetbar
3 Replies

2. UNIX for Advanced & Expert Users

SSH script

Hello All, I have public keys authentication set up already on my system, to connect to another team's system. What I'm trying to do is to write a script that connects to the customer's box, changes to a certain directory, and then changes the permissions of the files in that directory. ssh... (4 Replies)
Discussion started by: Khoomfire
4 Replies

3. Shell Programming and Scripting

SSH through a script

I want to use ssh through a script without setting key pair in those two machines. I ll take the password as input from user and then run some commands on remote machine. Can someone help me on how to do it (1 Reply)
Discussion started by: vickylife
1 Replies

4. Shell Programming and Scripting

SSH Script

So, right now I'm trying to make an SSH script for my place of employment. This script, I want to go out to the server hostnames we have specified (in another file) and change a users account password. We use Kerberized telnet, so if telnet root hostname fails, I want it to use ssh usernamehostname... (1 Reply)
Discussion started by: nkitmitto
1 Replies

5. Shell Programming and Scripting

Help on an ssh bash script...

Hey Guys, I want to have a bash script on my computer (Mac OS X 10.6.8) that can ssh into my iPod and respring. I know how do this by typing in "ssh root@10.0.1.10" and then typing in the password "alpine". From there i simply type "respring". I want to possibly put this into a shell script so it... (0 Replies)
Discussion started by: jetstream131
0 Replies

6. UNIX for Advanced & Expert Users

SSH using shell script terminates the script execution

Hello, I am writing a shell script in which i do ssh to remote server and count the number of files there and then exit. After the exit the shell script terminates which i believe is expected behavior. Can some one suggest me a way where even after the exit the script execution resumes. ... (2 Replies)
Discussion started by: manaankit
2 Replies

7. Shell Programming and Scripting

ssh script

I am connecting to a remote server using this ssh command: ssh -p 2222 username@***.***.***.*** I then get a password prompt where I enter the password. I need to make an ssh connection using a script instead of doing it manually. How can I automate the connection process and make the... (2 Replies)
Discussion started by: locoroco
2 Replies

8. Shell Programming and Scripting

script for ssh

The below command executing manually from server01. It will ask the password and retrieves the result(total number of characters in a filename.txt file available in server02) (username@server01)$ ssh username@server02 wc -c /log/filename.txt username@server02's password: 25500... (1 Reply)
Discussion started by: subi.ut
1 Replies

9. Shell Programming and Scripting

SFTP or scp with password in a batch script without using SSH keys and expect script

Dear All, I have a requirement where I have to SFTP or SCP a file in a batch script. Unfortunately, the destination server setup is such that it doesn't allow for shell command line login. So, I am not able to set up SSH keys. My source server is having issues with Expect. So, unable to use... (5 Replies)
Discussion started by: ss112233
5 Replies

10. UNIX for Beginners Questions & Answers

Ssh script to validate ssh connection to multiple serves with status

Hi, I want to validate ssh connection one after one for multiple servers..... password less keys already setup but now i want to validate if ssh is working fine or not... I have .sh script like below and i have servers.txt contains all the list of servers #/bin/bash for host in $(cat... (3 Replies)
Discussion started by: sreeram4
3 Replies
SSH-ARGV0(1)						    BSD General Commands Manual 					      SSH-ARGV0(1)

NAME
ssh-argv0 -- replaces the old ssh command-name as hostname handling SYNOPSIS
hostname | user@hostname [-l login_name] [command] hostname | user@hostname [-afgknqstvxACNTX1246] [-b bind_address] [-c cipher_spec] [-e escape_char] [-i identity_file] [-l login_name] [-m mac_spec] [-o option] [-p port] [-F configfile] [-L port:host:hostport] [-R port:host:hostport] [-D port] [command] DESCRIPTION
ssh-argv0 replaces the old ssh command-name as hostname handling. If you link to this script with a hostname then executing the link is equivalent to having executed ssh with that hostname as an argument. All other arguments are passed to ssh and will be processed normally. OPTIONS
See ssh(1). FILES
See ssh(1). AUTHORS
OpenSSH is a derivative of the original and free ssh 1.2.12 release by Tatu Ylonen. Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo de Raadt and Dug Song removed many bugs, re-added newer features and created OpenSSH. Markus Friedl contributed the support for SSH protocol versions 1.5 and 2.0. Jonathan Amery wrote this ssh-argv0 script and the associated documentation. SEE ALSO
ssh(1) Debian Project September 7, 2001 Debian Project
All times are GMT -4. The time now is 02:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy