How can I start a program from tty1 console to be executed in tty2 console?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
If so, you can start screen automatically on startup, using a specific screenrc configuration file, that automatically runs your chat program, and then detaches. That means that your screen will be running your chat on background, and you can pop it up on any tty you'd like.
The relevant .screenrc lines should be:
screen
stuff "my_chat_program^M"
detach
(The ^M is to feed a newline char to the command. If you want/need more commands, say cmd1 and cmd2, do:
stuff "cmd1;cmd2^M").
Once started, a screen session with this rc will auto-detach. To resume it, you have to call screen with the -r option. (If you get stuck with multiple screens, use -xRR which will most often than not do the trick - check the manual).
I can start the program in background using /etc/inittab but I dont know how to pop it up on a specific tty.
My linux pc does not have the graphical interface installed, only command line.
The GNU screen program works both in graphical and console terminals, so it should work in your setup.
Also, I do not know how to foreground a program ran in background through inittab. AFAIK, the background/foreground facility is built into bash (maybe in other shells also?), and each tty has its separate bash instance.
That is why you can't background something in tty1 with ctrl+z and foreground it on tty2 with "fg %program", though that would be really useful for you.
Screen does this and much more, I really recommend you give it a try, it will solve your problem and supply you with an invaluable GNU/Linux tool.
Clever! You added the myprogram invocation to the tty spawner. When you quit myprogram, do you get a shell or does myprogram respawns? (IOW does tty5 becomes "locked" in a chat screen?)
YES, this is exactly what I need. I have the first console with the main program (ALT+F1) and (ALT+F8) is using all the time the chat program for SUPPORT on the main program. The chat clients will connect on a central server (Openfire).
Clever?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.