ssh XXXXX@XXXXX'. $HOME/.profile 2>/dev/null;cd $COMMON_TOP/admin/scripts/$CONTEXT_NAME; adcmctl.sh start "apps${AppsPass}" || cd $ADMIN_SCRIPTS_HOME; adcmctl.sh start "apps${AppsPass}"'
As per our business requirement we should be able to execute the above two commands seprated with or ( || ) based on the Oracle applications version. But the command is not working looks like with special characters . Can anybody help in resolving this pls .
Create remotescript.sh as follows:
. $HOME/.profile 2>/dev/null
cd $COMMON_TOP/admin/scripts/$CONTEXT_NAME
adcmctl.sh start "apps${AppsPass}" || cd $ADMIN_SCRIPTS_HOME
adcmctl.sh start "apps${AppsPass}"
while perhaps the following is meant?:
. $HOME/.profile 2>/dev/null
cd $COMMON_TOP/admin/scripts/$CONTEXT_NAME
adcmctl.sh start "apps${AppsPass}" || {
cd $ADMIN_SCRIPTS_HOME
adcmctl.sh start "apps${AppsPass}"
}
Run it like this on the remote host HHHHH:
ssh -x XXXXX@HHHHH /bin/sh < remotescript.sh
Looks like you're missing something in the below scripts.I've tried something like this with your suggestions but its giving errors.
ssh XXXXX@HHHHHH '. $HOME/.profile 2>/dev/null;'cd $COMMON_TOP/admin/scripts/$CONTEXT_NAME; adcmctl.sh start "apps/${AppsPass}" || {cd $ADMIN_SCRIPTS_HOME; adcmctl.sh start "apps/${AppsPass}"}
I'm getting this errors.
-bash: adcmctl.sh: command not found
-bash: {cd: command not found
-bash: adcmctl.sh: command not found
I told you to create a script remotescript.sh with 4 or 6 lines,
and then pass/run the remotescript.sh via ssh to/on the remote host.
If you can modify your sshd configuration file, you could also rewrite your script as an ssh2 subsystem and invoke it as follows:
ssh -s remotescript remoteserver.example.com