

nohup: redirecting stderr to stdout解决办法
source link: https://blog.csdn.net/iechenyb/article/details/76270595
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

我的启动命令是这样的:
nohup bin/startManagedServer.sh myserver htp://192.168.0.1 -Xms2048m -Xmx2048m > logs/myserver.out & 现在指行这个命令,会给我产生两个文件,一个中logs/myserver.out,另一个是nohup.out文件。
怎样才能让它不产生nohup.out文件呢。
网上搜了半天,据说好象可以把后面的 “ & ” 改成 “ 2>&1 & ”,于是把启动命令改成如下:
nohup bin/startManagedServer.sh myserver htp://192.168.0.1 -Xms2048m -Xmx2048m > logs/myserver.out 2>&1 &再次执行,问题解决。
解释如下:
2>
表示把标准错误(stderr)重定向,标准输出(stdout)是1。
尖括号后面可以跟文件名,或者是&1, &2,分别表示重定向到标准输出和标准错误。
2> &1
1> &2
2> stderr.log
1> stdout.log
Recommend
-
34
说到在Linux系统上后台运行任务,可能很多人的第一反应是 nohup 命令,可能还会有人提到 screen 命令。今天老张就给大家介绍这两个命...
-
15
Python UTF-8 print fails when redirecting stdoutPython UTF-8 print fails when redirecting stdout Wed 26 January 2011Consider the following piece of code: # -*- coding: utf-8 -*- print u"Վարդանաշեն" Runni...
-
19
Redirecting stderr of a running process Redirecting stderr of a running process May 4, 2018 on Drew DeVault's blog During the KDE sprint in Berlin,
-
30
Introduction Among the popular operating systems, they have all standardized on using standard input, standard output, and standard error with file desciptors 0, 1, and 2 respectively. This allows you to pipe the inputs and outputs...
-
20
Introduction When you use print() in python the output goes to standard output or sys.stdout. You can directly call sys.stdout.write() instead of using print(), but you can also co...
-
28
Introduction Operating systems recognize a couple special file descriptor IDs: STDIN - 0 - Input usally coming in from keyboard. STDOUT - 1 - Output from the...
-
17
Bash打印中的stdout与stderr 2017-07-26 10:58:36 +08 字数:2134 标签: Bash 简介stdout与stderr
-
10
将命令的输出重定向到文件或将其通过管道传递到另一个命令时,您可能会注意到错误消息已打印在屏幕上。在Bash和其他Linux Shell中,执行程序时,它使用三个标准I/O流。 每个流由一个数字文件描述符表示:0-stdin...
-
12
命令列工具的 stdout, stderr 輸出與 .NET 整合應用-黑暗執行緒 昨天提到的 Linux 掃描工具 - scanimage,剛好有個經典輸出分流行為,scanimage 將圖檔傳到標準輸出(Standard Output),...
-
9
Conversation Contributor In all other places (e.g. bootstrap.py, opt-dis...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK