Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 09-09-2006, 09:11 AM   #1
Registered: Jun 2005
Posts: 82

Rep: Reputation: 15
Cool Cycle Virtual Consoles Automatically (Demo/Status Mode)

Hi All

Thought you might find this useful and/or someone might offer a huge improvement on this!

I coded this up in bash. It's a bit of a joke, really, but it works!

It automatically cycles between the first 6 virtual consoles at a user specifiable interval (or 3 seconds by default).

If you start typing on any console, it waits until there has not been any keypress for the last mentioned interval, before switching consoles - in order to allow you to actually use the consoles without it switching mid-typing.

The script consists of 5 tiny scripts that fork and call each other and go mad. Obviously a compilable c program would be much better, and should be quite simple to code. Even a bash script that contains everyting in one single script, would be better. Anybody?

Whats the use of this?

It's pretty cool if you have a syslog tailed on one vt, a top on the other, an iftop on yet another, etc.. you get the idea.

---------------------- /v
if [ $1 -gt 0 2>/dev/nul]; then s=$1; fi;
while true; do
if [ $vt -gt 6 ]; then vt=1; fi
while [ $(/vk2 $s 2>/dev/nul) ]; do
cat /dev/null;
chvt $vt;
---------------------- /vk
dd if=/dev/input/event1 bs=1 >/dev/nul 2>&1 </dev/nul
---------------------- /vk1
if $(/vk); then echo true; fi
---------------------- /vk2
/vk1 & vk1=$!;
/vk3 $1 $vk1;
---------------------- /vk3
sleep $1;
kill -9 $2;
Linux has some serious console issues. And bash some serious syntax issues. Anyways, putting the </dev/nul on the dd line, makes vk only sit in memory with 5 stale dd's tops, unlike just accumulating them until the next key is pressed as it does without. Geez. When are OS's and scripting and programming gonna come of age. I tried a few variations such as forking dd to the background, but then the return value is lost. Maybe theres a better way to check for activity on /dev/input/event1 that I'm not aware of right now.

Last edited by tunasashimi; 09-09-2006 at 05:36 PM.
Old 09-10-2006, 06:52 PM   #2
LQ Newbie
Registered: Mar 2006
Posts: 16

Rep: Reputation: 0
try using a framebuffer also to jack up the vt res and this could look nice
good work
Old 09-11-2006, 07:58 PM   #3
Registered: Jun 2005
Posts: 82

Original Poster
Rep: Reputation: 15

Originally Posted by navaburo
try using a framebuffer also to jack up the vt res and this could look nice
good work
Thanks, this works for me. I've spotted some "monkey business" on my server with this, I would have only picked up much later otherwise...

Still waiting for someone to write a one-file version with subroutines instead of separate scripts, or in c.

Hopefully someone will beat me to it
Old 09-12-2006, 07:14 AM   #4
LQ Newbie
Registered: Mar 2006
Posts: 16

Rep: Reputation: 0

might give you some ideas. Its from Linux Desktop Hacks by O'Reilly.

You might be able to trigger the vt switch through those keys, or by customized triggers.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
No virtual consoles slacard *BSD 2 05-12-2006 06:46 PM
virtual consoles pesachzon Linux - Software 1 05-15-2005 05:09 PM
command to cycle X mode dummy1 Linux - Software 2 09-16-2004 05:09 AM
runlevel 4 and virtual consoles stevenhasty Slackware 16 08-06-2003 08:20 PM
virtual consoles naflan Slackware 1 08-02-2003 12:13 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:55 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration