本文介绍了发送nohup的输出错误的系统日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编写使用的nohup并传递错误rsyslog现在一个bash脚本。

我试着日志变量的不同变化这个命令(见下文),但不能得到传递到任何东西,但一个std txt文件的输出。我不能去管。

 的nohup imageprocessor.sh> $ LOG&放大器;

是否有可能管nohup的输出还是我需要一个不同的命令。

一对夫妇的日志变化,我已经试过

  LOG =|在/ usr /斌/记录器-t workspaceworker -p LOCAL5.info和2

  LOG =| logtosyslog.sh

  LOG =logtosyslog.sh


解决方案

庆典 A的方式输出重定向到系统日志是:

  EXEC> >(记录仪-t myscript)的

标准输出然后被发送到记录命令

  EXEC 2  - ; >(记录仪-t myscript)的

标准错误

I'm attempting to write a bash script that uses nohup and passes errors to rsyslog.

I've tried this command with different variations of the log variable (see below) but can't get the output passed to anything but a std txt file. I can't get it to pipe.

nohup imageprocessor.sh > "$LOG" &

Is it possible to pipe nohup output or do I need a different command.

A couple of variations of log that I have tried

LOG="|/usr/bin/logger -t workspaceworker -p LOCAL5.info &2"

or

LOG="|logtosyslog.sh"

or

LOG="logtosyslog.sh"
解决方案

A way in bash to redirect output to syslog is:

exec > >(logger -t myscript)

stdout is then sent to logger command

exec 2> >(logger -t myscript)

for stderr

这篇关于发送nohup的输出错误的系统日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-05 08:20