I have 3 commands that i need to run on a remote server.
The 2 commands are simple version checks and 3rd command is basically a short program that checks version of my database. This is how it goes
#!/bin/sh
ssh -t user@server << EOF
#AIP_version
domaininfo -d $GLOBAL_DOMAIN -history | head -n -3 | tail -1 > /home/abc/aip_version.txt
## Fetching AIP Online Details ##
variable1=$(
echo "set feed off
set pages 0
select * from system_parameters where name like '%VERS%';
exit
" | sqlplus /@aipprealias01
)
echo "$variable1" > aipo_version.txt
#Fetching RPAS-AIP Details
domaininfo -d $GLOBAL_DOMAIN -version | sed -n '4,7p' > /home/abc/rpas-aip_version.txt
EOF
When I try to run this script, it gives me below errors :
Pseudo-terminal will not be allocated because stdin is not a terminal.
-bash: line 8: SQL*Plus:: command not found
-bash: line 10: syntax error near unexpected token `c'
-bash: line 10: `Copyright (c) 1982, 2014, Oracle. All rights reserved.'
I'd need help in understanding how can this error be resolved and secondly how can I run this script to do ssh on multiple servers rather than just 1 ? Thanks!
ssh
). Does it work? make sure you are using the right shell. Once that works locally at the remote system, you can move on and try tossh -t
it.