【发布时间】:2013-08-10 06:21:18
【问题描述】:
我需要远程登录到服务器并使用nohup 在后台运行带有参数的shell 脚本。但我收到一个错误。我在语法上遗漏了什么吗?
我的代码:
ssh -t -t user@servername nohup /path/myscript.sh argument1 argument2 & > /path/myscrip_logfile.log
输出:
Invalid null command.
【问题讨论】:
我需要远程登录到服务器并使用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"
【讨论】: