LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 11-02-2016, 12:55 PM   #1
jason0597
LQ Newbie
 
Registered: May 2016
Posts: 3

Rep: Reputation: Disabled
Autologin & Autostart bash scripts on Debian 8 Jessie (systemd) for server use


Perhaps this should have been in Linux - General...
For tl;dr, read bold paragraph:

I have a virtual machine that runs Debian 8, and I have configured it to not start X server and boot into a terminal window. So far we are good.

But, I have 3 game servers that I want to run on the same computer (mcserver, tf2server and an FTB minecraft server).

Since I didn't have terminal tabs like in a Desktop Environment, I decided to use tty2-tty4 to run each server independently (so I can quickly switch to each tty and access each server's console at will)

I can do this very easily manually, but since the host computer has frequent restarts I wanted to set it up so it auto logins to 4 seperate accounts on each tty1-4 (jason, mcserver, tf2server and ftbserver respectively) automatically and then runs the servers (all of which are bash scripts).

This is where I run into issues. I have tried tmux with multiple windows running seperate commands, I have tried modifying files in /etc/ and accidentally locked myself out and had to resort to GRUB rescue terminal, and I have tried writing many bash scripts and trying to get them to auto run but failed.

Maybe I don't even need to autologin to the 4 terminals like I want, but what I do want is:

I want run 3 different bash scripts (2 of which have a y/n prompt that I need make the computer automatically answer yes (the "y" on the prompt is already typed in, all that is needed is for ENTER to be pressed)) on tty2-tty4 every time I start my computer, and as a consequence I believe I need to login to 3 different accounts on tty2 through tty4.

Help would be greatly appreciated!

Last edited by jason0597; 11-02-2016 at 01:09 PM.
 
Old 11-02-2016, 02:38 PM   #2
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,585

Rep: Reputation: 2351Reputation: 2351Reputation: 2351Reputation: 2351Reputation: 2351Reputation: 2351Reputation: 2351Reputation: 2351Reputation: 2351Reputation: 2351Reputation: 2351
Try screen or similar...
 
Old 11-02-2016, 02:58 PM   #3
jason0597
LQ Newbie
 
Registered: May 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by 273 View Post
Try screen or similar...
Can an autostart behaviour be accomplished with tmux?
 
Old 11-03-2016, 10:25 AM   #4
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 9 Stretch
Posts: 2,393
Blog Entries: 8

Rep: Reputation: 409Reputation: 409Reputation: 409Reputation: 409Reputation: 409
I'll be honest, I am not familiar with how to autostart things on particular tty's, but thinking about your problem perhaps a tabbed terminal with four different ssh sessions into your server would be a more elegant solution? That way, you can just click on the various tabs to access the desired session, or you can even pull off tabs so you can view multiple sessions side-by-side.

Assuming the computer with the tabbed terminal doesn't have frequent reboots (why do you have frequent reboots?), you can set up each session with a command like:

Code:
ssh debianvm "mcserverscript"
After a reboot of the debian VM, you just press UP-ARROW and then ENTER in each of the tabs to reconnect and start the server scripts. If you want to get really fancy, you can set up a script on a loop which will automatically try and reconnect via ssh and run the script. In other words, the VM itself doesn't have any automation to start anything upon reboot. Rather, the computer with the tabbed terminal has scripts which will frequently attempt to reconnect and restart the scripts if the ssh session is disconnected.
 
Old 11-08-2016, 02:06 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,863

Rep: Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598
Would 'Expect' work for you?
eg http://www.admin-magazine.com/Articl...Expect-Scripts
 
  


Reply

Tags
autologin, autostart, debian jessie


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
how to autostart xscreensaver in debian jessie jobsworth Debian 0 02-02-2016 08:44 PM
LXer: Debian ships new 'Jessie' release with systemd AND sysvinit LXer Syndicated Linux News 0 04-29-2015 03:20 AM
[SOLVED] Debian Jessie systemd and display manger unmaintanable since ~2014/07/20 jisisv Debian 17 07-28-2014 05:20 PM
KDE 4 Autostart Program Bash Script to Write Autostart Bash Scripts for You! jdmcdaniel3 SUSE / openSUSE 1 05-03-2010 06:17 AM
Autostart Samba & Running scripts at boot DocNick Linux - General 5 11-09-2004 05:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:37 PM.

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