0

I'm trying to make a pretty nice desktop console which can show system logs from /dev/logi . The device displays new content from several files in /var/log . I want to use urxvt and tmux to do so. Everything seems to be working, but I have no idea how to autostart it. I'm using openbox, so I tried adding the following line to /home/morfik/.config/openbox/autostart :

(sleep 2 && urxvt -name 'konsola_desktop' -e sh -c "tmux -c 'cat /dev/logi'") &

This doesn't work as expected. urxvt stars and if something is logged, it is displayed on the console. But one part is missing, there's no tmux. I need it because I set in /home/morfik/.Xresources the following option:

URxvt*saveLines: 0

and I use tmux buffer specified in /etc/tmux.conf :

set -g history-limit 5000

So, if I start the command above, I'm not able to scroll output. I can't even divide screen because tmux isn't there. There's also no tmux process:

ps -eo "%mem args" | grep -i tmux
1.1 urxvt -name konsola_desktop -e sh -c tmux -c 'cat /dev/logi'
0.0 sh -c tmux -c 'cat /dev/logi'

But when I just do the following steps:

urxvt -name 'konsola_desktop'
tmux
cat /dev/logi

everything works just fine:

ps -eo "%mem args" | grep -i tmux
0.1 tmux
0.1 tmux

Does anyone know what's going on?

  • The -c option is the problem here: it just acts as a “pass through” to a shell (tmux’s configured default-shell)—this is usually only useful when tmux is configured as a user’s login shell (since other programs might assume the login shell knows how to handle args like -c shell_cmd_str). You probably want to use new-session instead of -c. – Chris Johnsen Dec 15 '13 at 4:15
  • I defined two sessions in tmux config file, and now I'm using (sleep 2 && urxvt -name 'cdesktop' -e bash -c "tmux attach-session -t logi") &, and everything works as expected. – Mikhail Morfikov Dec 15 '13 at 19:42
1

I found a solution.

First off all, it's better to use tmux config file instead of putting a command in the autostart line. So, it would be:

new true
set set-remain-on-exit on
new -n logi "cat /dev/logi"
neww -n test
splitw -v -p 50 -t 0 
neww -n test2
splitw -h -p 50 -t 0
set -u set-remain-on-exit

The above lines should be added to /etc/tmux.conf , and now the line that starts the console should look like this:

(sleep 2 && urxvt -name 'konsola_desktop' -e bash -c "tmux attach") &

It's even better because I can define multiple windows and switch between them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.