LoginSignup
2
2

More than 5 years have passed since last update.

tmuxでログをのこしたい

Last updated at Posted at 2017-08-29

pipe-paneを使って幸せになりましょう。

tmux new \; pipe-pane "cat >> $PWD/log.txt"

ただし、これはセッションまるごと保存しようとするものであり、
必ずしもログとして嬉しくないかもしれません。

user@vultr:~/foo$ tmux new "foreman start; bash" \; pipe-pane "cat >> $PWD/log.txt"
# セッションを手動で止める
user@vultr:~/foo$ cat log.txt
23:16:54 web.1  | started with pid 11223
23:16:55 web.1  | [2017-08-29 23:16:55] INFO  WEBrick 1.3.1
23:16:55 web.1  | [2017-08-29 23:16:55] INFO  ruby 2.4.0 (2016-12-24) [x86_64-linux]
23:16:55 web.1  | == Sinatra (v2.0.0) has taken the stage on 5000 for development with backup from WEBrick
23:16:55 web.1  | [2017-08-29 23:16:55] INFO  WEBrick::HTTPServer#start: pid=11223 port=5000
^C(← いらない)23:17:08 system | SIGINT received, starting shutdown
23:17:08 web.1  | == Sinatra has ended his set (crowd applauds)
23:17:08 web.1  | [2017-08-29 23:17:08] INFO  going to shutdown ...
23:17:08 web.1  | [2017-08-29 23:17:08] INFO  WEBrick::HTTPServer#start done.
23:17:08 system | sending SIGTERM to all processes
23:17:08 web.1  | exited with code 0
user@vultr:~/foo$ exit ← いらない
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2