我需要通过远程登录到服务器,并使用nohup
在后台运行带参数的shell脚本。但是我遇到了一个错误。我在语法上是否缺少了什么?
我的代码:
ssh -t -t user@servername nohup /path/myscript.sh argument1 argument2 & > /path/myscrip_logfile.log
输出:
Invalid null command.
nohup接受像您提供的参数,"& >"应该改为"&>",整个命令应该用引号括起来,否则我认为您正在重定向ssh命令的标准输出,因此请尝试以下操作:
ssh -t -t user@servername "nohup /path/myscript.sh argument1 argument2 &> /path/myscrip_logfile.log"