jsch ChannelExec run a .sh script with nohup “lose” some commands

强颜欢笑 提交于 2019-11-29 08:28:51
Han Zheng

Solved!

A different issue that often arises in this situation is that ssh is refusing to log off ("hangs"), since it refuses to lose any data from/to the background job(s).[6][7] This problem can also be overcome by redirecting all three I/O streams.

from http://en.wikipedia.org/wiki/Nohup

My prob is, psql and pg_bulkload print their outputs to err stream.

In my script, I didn't redirect err streams.

Everything went fine by also redirecting err streams to the same log file.

nohup foo.sh > log.log 2>&1 &

Thanks to Atsuhiko Yamanaka, he created a great JSch library, and Paŭlo Ebermann for the documentation.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!