后台守护运行提示nohup: ignoring input and appending output to `nohup.out’
在搭建gogs时想要它后台运行。nohup ./gogs web
提示:nohup: ignoring input and appending output tonohup.out’ 意思是 :忽略输入并将输出附加到nohup.out’
程序也能正常启动。
如果不想看到这个提示可以使用如下三种方式:
1、nohup sh xxx.sh >a.log 2>& 1 &
2、nohup sh xxx.sh &>a.log &
# 如果不想输入到a.log 可以使用
3、nohup sh xxx.sh >/dev/null 2>& 1 &
其中:
nohup放到命令开头表示不挂起,表示即使退出终端该进程也不会掉, & 放在命令到结尾,表示后台运行
- /dev/null 表示空设备文件 (位桶(bit bucket)或者黑洞(black hole)的地方)
- 0 表示stdin标准输入
- 1 表示stdout标准输出
- 2 表示stderr标准错误
- 2>&1表示将错误输出重定向到标准输出,注意>& 不能分开

浙公网安备 33010602011771号