gpt4 book ai didi

shell - 使用 nohup 运行带参数的 shell 脚本

转载 作者:行者123 更新时间:2023-12-01 02:24:01 25 4
gpt4 key购买 nike

我需要远程登录到服务器并使用 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"

关于shell - 使用 nohup 运行带参数的 shell 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18127700/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com