【问题标题】:Redirecting logs in shell script在 shell 脚本中重定向日志
【发布时间】:2018-01-20 09:51:32
【问题描述】:

感谢您调查我的问题。

我的 shell 脚本中有一段代码,如下所示,我想将下面脚本的日志重定向到一个文件。你能帮忙吗?

ssh -i /home/$cu/.ssh/${ssh_key}_rsa $Linux_User@$Linux_Machine <<EOF
{
source $HOME/.bashrc >/dev/null
chmod 777 -R ${Target_Dir}/Scripts/ >/dev/null
sh ${Target_Dir}/Scripts/tomcat.sh ${Target_Dir}
source $HOME/.bashrc >/dev/null
sh ${Target_Dir}/Scripts/appdeploy-multi.sh ${Target_Dir} $APP_VERSION $APP_NAME
sh ${Target_Dir}/Scripts/check-status.sh $APP_NAME
rm -rf ${Target_Dir}/
}
EOF

【问题讨论】:

标签: bash sh stdout heredoc output-redirect


【解决方案1】:

@cyrus/janos:非常感谢。它解决了问题。

ssh ... <<EOF > file.log

【讨论】:

    猜你喜欢
    • 2014-11-08
    • 2013-12-21
    • 1970-01-01
    • 2019-08-21
    • 2022-09-23
    • 1970-01-01
    • 2023-03-04
    • 1970-01-01
    • 2020-05-28
    相关资源
    最近更新 更多