Discussion:
hi, I can't get "tmux pipe-pane" to work
Sebastian Tarach
2014-10-19 22:33:39 UTC
Permalink
Hello,

I want to force tmux to log my server daemon output but can't get this to
work :/ pipe-pane only works for me when I type it myself in tmux window
after attaching it. I can't "send" the pipe-pane command to detached tmux
instance to start its logging.

Thanks in advance

I have also put script from below here: http://pastebin.com/yPPxHHSN

#!/bin/bash
session="test"
logfile="${HOME}/tmux-$(date +'%Y.%m.%d-%H.%m')-METHOD-"

echo "LOG FILE: ${logfile}"

#if [ -e $logfile ]; then
# rm $logfile
#fi

tmux new-session -d -s $session

function senddata {
tmux send-keys -t ${session} "echo TEST ${1}.1" C-m
tmux send -t ${session} "echo TEST ${1}.2" ENTER
}

# METHOD A
tmux pipe-pane -o -t ${session} "cat > ${logfile}A.log"
senddata A

# METHOD B
tmux send -t ${session} "tmux pipe-pane -o -t ${session} 'cat >
${logfile}B.log'" ENTER
senddata B

# METHOD C
tmux send-keys -t ${session} "tmux pipe-pane -o -t ${session} 'cat >
${logfile}C.log'" C-m
senddata C

echo "LISTING LOGS"
ls "${logfile}*"
Sebastian Tarach
2014-10-20 02:11:11 UTC
Permalink
Ok nevermind I've compiled and updated tmux 1.9a from Debian 1.3-2 (
aptitude ) and two examples A and C work!

~Cheers
Post by Sebastian Tarach
Hello,
I want to force tmux to log my server daemon output but can't get this to
work :/ pipe-pane only works for me when I type it myself in tmux window
after attaching it. I can't "send" the pipe-pane command to detached tmux
instance to start its logging.
Thanks in advance
I have also put script from below here: http://pastebin.com/yPPxHHSN
#!/bin/bash
session="test"
logfile="${HOME}/tmux-$(date +'%Y.%m.%d-%H.%m')-METHOD-"
echo "LOG FILE: ${logfile}"
#if [ -e $logfile ]; then
# rm $logfile
#fi
tmux new-session -d -s $session
function senddata {
tmux send-keys -t ${session} "echo TEST ${1}.1" C-m
tmux send -t ${session} "echo TEST ${1}.2" ENTER
}
# METHOD A
tmux pipe-pane -o -t ${session} "cat > ${logfile}A.log"
senddata A
# METHOD B
tmux send -t ${session} "tmux pipe-pane -o -t ${session} 'cat >
${logfile}B.log'" ENTER
senddata B
# METHOD C
tmux send-keys -t ${session} "tmux pipe-pane -o -t ${session} 'cat >
${logfile}C.log'" C-m
senddata C
echo "LISTING LOGS"
ls "${logfile}*"
Loading...