there's an idea i've had for a while, that would be really nice to have, but i never found a way. that being to have information auto-scroll on a monitor / in a terminal. i had thought this useful for not just various system infos, but for monitoring all sorts, or even just scrolling kernel source code (lol), so it can be available at a glance, without interaction. or even perhaps a slow scroll of large outputs, like "tree /".
icarus has just come into irc asking for a fairly similar idea... which i'll let him explain:
(09:05:34) icarus: ok, so say you have a monitor you use as a display
(09:05:39) icarus: and it shows information
(09:06:00) xskoulax: ok
(09:06:11) icarus: Say, htop, jnettop, netstat stuff, iotop, ttytter, etc
(09:06:16) icarus: just cli apps that show info
(09:06:20) apm1 [~apm@unaffiliated/apm1] entered the room.
(09:06:25) icarus: and this monitor is passive
(09:06:31) icarus: not used for any kind of input
(09:06:49) icarus: what kind of method would you use to get these different console cli apps to cycle through each other
(09:06:57) icarus: in a multiplexer, say
(09:06:59) icarus: like tmux
(09:07:00) icarus: or screen
(09:07:21) icarus: tmux: open will all of these tools, top, iotop, jnettop, etc
(09:07:31) icarus: and it changes windows every minute, say
(09:07:50) Digit: to cycle... mmm. that'd be nice. i've long wanted an auto scrolling feature for siimilar
(09:08:19) icarus: tmux doesnt really have an api that allows outside output into a session
(09:08:51) icarus: i mean i see tmux -L
(09:09:17) xskoulax: not really used a multiplexer, so you're thinking have the monitor run a true tty and then cycle through various monitoring apps
(09:09:39) icarus: yeah
(09:09:47) Digit: i want to get this put in a thread, so that it can be up there for good, and help others, and garner more help too
(09:10:01) icarus: yeah, cause it would be really badass
(09:10:46) xskoulax: that would be very bad ass
indeed, this would be a very badass feature to have.
scrolling? cyclic? some way to get all that infos being shuffled along to be able to display more information than can be contained on screen at any one time, via the 4th dimension (time).
we the crunchbang community can surely put our heads together and fathom at least a few ways of achieving this, right?
Last edited by Digit (2013-01-24 09:20:08)
I found a way to remotely change windows in tmux!
Ex: tmux select-window -t sessionname:1
I'm going to work on a script to cycle through active windows using this method.
Also tmux, unlike screen, can share windows
So you could have a display box with a tmux session running for monitoring, and ssh in and attach the session and change things as need be.
I'll get my script code up here as I work on it tonight!
Does anyone else have any other method ideas?
i'm pondering some kind of cat and sleep method... heads n tails
which one could control the delay on, and combine with the cyclic method, so it moves on to show the next page of any of these large outputs each time it comes around.
i'm not quite managing to figure out how to get it to know where to move onto for the next... like how it remembers it's done lines a to f so next time it shows g to l, or whatever. maybe if there were a way to script up the equivalent of pressing space in less/more...
i'm really keen on these two ideas coming together though. not only would you be able to set the timings so that when a screen has cycled around back to the same big wall of text to be scrolled and have it tick on to the next page, you could also set these sort of timings so that in the minute (or however long) you have a page on display, it could be scrolling for that duration too! (like one line every 5 seconds or whatever.) ... though getting it to stop scrolling while not visable in the cycle... that, i have no idea about yet. (at least, no clever idea about anyways)
Last edited by Digit (2013-01-24 12:09:02)
n2o4 added the following to the converstion a little later.
2013-01-24 05:25:38 n2o4 icarus: Here's something I threw together quickly. It opens four panes in tmux (top, tail following syslog, iotop and htop) in an evenly tiled layout. http://sprunge.us/LQDa 2013-01-24 05:25:39 <-- TheGrey_ (~TheGrey__@184.108.40.206) has quit (Read error: Connection timed out) 2013-01-24 05:26:03 n2o4 You can add windows and panes as you feel necessary and cycle through them. 2013-01-24 05:26:11 --> TheGrey_ (~TheGrey__@220.127.116.11) has joined #crunchbang 2013-01-24 05:27:42 n2o4 The ones with sudo must either be in sudoers or you have to enter the password manually each time. Source it in tmux with prefix : /path/to/monitor-session-file
content of http://sprunge.us/LQDa follows.
new -s monitor -n monitor top split-window -v -t monitor send-keys -t monitor 'sudo tail -f /var/log/syslog' C-m split-window -h -t monitor send-keys -t monitor 'sudo iotop' C-m split-window -v -t monitor send-keys -t monitor 'htop' C-m select-layout -t monitor tiled
Hopefully that is of some use to someone.
I ended up getting really busy, so didn't have time last night, but I played around with the code n2o4 posted, and the flow is right but the send-keys function is wrong.
Also, the tmux denotion is missing, and I added in $1 so you can name the session whatever you want.
#!/bin/sh tmux new -s $1 -n $1 top tmux split-window -v -t $1 tmux send-keys -t $1 'sudo tail -f /var/log/syslog' M-n tmux split-window -h -t $1 tmux send-keys -t $1 'sudo iotop' C-m tmux split-window -v -t $1 tmux send-keys -t $1 'htop' C-m tmux select-layout -t $1 tiled
I've done it!
I'm so incredibly proud of this little script. Enjoy guys!
./script.sh $tmux-session-name $time-interval-in-seconds
Cycles the windows in your specified "tmux new -s NAME" for N seconds.
#!/bin/bash for (( ; ; )) do sleep $2s; tmux next-window -t $1; done
With this, you can setup a big tmux session filled with all kinds of CLI info-graphics-diangostics-etcetera and it will cycle on your display monitor proudly and boldly until the end of time. Hurray!
I'll maybe write up a more complicated script for asking you what you want to name your tmux session, and what info graphics you want to run in each window at a later date. For now I gotta get on with my day. Cheers!
I was trying to do a whole bunch of complicated things with tmux, but it just boiled down to the next-window feature I overlooked in the tmux man page.