I have created simple script which will telnet to any unix server and will perform the tasks required.
#Remote_Telnet.sh
------------------------------------
#!/bin/ksh
. ~/.profile
HOST='192.168.1.100'
DELAY=3
USER='oracle'
PASSWORD='oracle'
COMMAND1='cd /home/oracle'
(
sleep 3
print "${USER}"
sleep 3
print "${PASSWORD}"
sleep 3
print "Starting Patch Deployment on ${HOST}"
sleep 1
print "cd /app/dbsrvr"
print ". ./dbenv.sh"
print "cd bin"
print "./stop_server.sh"
print "cd /app/dbserver/patches"
print "opatch apply"
print "cd /app/dbsrvr/bin"
print "./start_server.sh"
sleep 1
print "exit"
sleep 3
) | telnet "${HOST}"$
------------------------------------
Currently I have hard-coded IP and user details but you can change this to enter the values at run time and change the script to accept those values and connect to that specific server.
for example:
#Remote_Telnet.sh `192.168.1.100` oracle password
------------------------------------
#!/bin/ksh
. ~/.profile
HOST='$1'
DELAY=3
USER='$2'
PASSWORD='$3'
------------------------------------