尝试运行外壳程序脚本时冻结

时间:2019-05-26 14:00:44

标签: linux bash git shell

我已经为我编写了一些bash / shell脚本,以更新远程服务器上的GIT存储库。我可以通过ssh system手动连接,因此这必须可行。但是,当我尝试使用脚本时,它不起作用,因为在我要更新哪个系统的问题后,它挂断了。我在这里做错了什么?

#!/bin/bash

#Ask for the system
echo "Which system do you want to update? (s = Staging / p = Prod)"

#Get result
read system

if [ $system = "s" ]; then
   #Connect to Server and update staging
   ssh server 'su git_user; cd ~/staging.server.de/wp-content/; git pull'
else
  #Connect to Server and update prod
  ssh server 'su git_user; cd ~/httpdocs/wp-content/; git pull'
fi

当我手动执行每个步骤时,它就像一个超级按钮。

编辑:

这是su git_user之后我要执行的命令:

server@plesk ~ # su git_user
git_user@plesk:/server$
git_user@plesk:/server$ cd ~
git_user@plesk:~$ cd httpdocs/wp-content
git_user@plesk:~/httpdocs/wp-content$ git pull
Already up to date.

0 个答案:

没有答案