I have a problem with running sh scripts on CentOS which calls remote sh file. On user@host1 I have start.sh file with next command inside

NODE1_SSH_PATH=user@host2
PROGRAM_HOME=/home/user/app

ssh $NODE1_SSH_PATH $PROGRAM_HOME/bin/run.sh > start.log

Result of this script is next:

bash: /home/user/app/bin/run.sh: Permission denied

I tried run this script with chmod like this:

ssh $NODE1_SSH_PATH chmod u+x $PROGRAM_HOME/bin/run.sh > start.log

But in this case I have't got any result, log file is empty to. Could someone help me to slow this I hope simple task?

有帮助吗?

解决方案

I believe /home/user/app/bin/run.sh is not executable.

try this

ssh $NODE1_SSH_PATH /bin/bash $PROGRAM_HOME/bin/run.sh > start.log
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top