HerringTin
Posts: 3
Joined: Fri Jul 08, 2016 11:10 am

I cant enter commands in the terminal!

Fri Jul 08, 2016 11:24 am

I just set up my Pi 2 as a minecraft server and made it so the set of commands that start the server are executed at startup. It all starts fine but while its running i cant enter any commands, I can type things but it acts as if lines of code are still being executed so if i press enter nothing happens, even if the commands i type are for the server program. This is a bit of a problem bcause i cant stop the server from starting since i cant enter commands so im just powerless! Does anyone know how to fix this?

User avatar
topguy
Posts: 6683
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: I cant enter commands in the terminal!

Fri Jul 08, 2016 1:45 pm

If you start a program on the commandline (in a shell) then you will not get back the command-prompt until the program is finished.

You have two choices:
- Start the program in the background. you do this by adding a "&" character to the end of the command.
( test the difference between "sleep 100" and "sleep 100 &", if you type "jobs" after the last one it will be listed as a job running in the background. )
Programs running in the background will still print their output to the shell you are working with that can be confusing/annoying. See next alternative.

- Open another terminal.
From the desktop -menu you can just start another terminal-window.
If you have not started the desktop you can try to press "ctrl+alt+F2". Most linux systems has multiple virtual terminals that can be chosen by pressing respective "ctrl+alt+Fn".

HerringTin
Posts: 3
Joined: Fri Jul 08, 2016 11:10 am

Re: I cant enter commands in the terminal!

Fri Jul 08, 2016 2:06 pm

topguy wrote:If you start a program on the commandline (in a shell) then you will not get back the command-prompt until the program is finished.

You have two choices:
- Start the program in the background. you do this by adding a "&" character to the end of the command.
( test the difference between "sleep 100" and "sleep 100 &", if you type "jobs" after the last one it will be listed as a job running in the background. )
Programs running in the background will still print their output to the shell you are working with that can be confusing/annoying. See next alternative.

- Open another terminal.
From the desktop -menu you can just start another terminal-window.
If you have not started the desktop you can try to press "ctrl+alt+F2". Most linux systems has multiple virtual terminals that can be chosen by pressing respective "ctrl+alt+Fn".
Thanks heaps! Ur the toppest guy. The multiple terminals solve other problems for me too. Is there any way i can still send commands to the server program though if its in the background or its terminal is unresponsive?

User avatar
RaTTuS
Posts: 10574
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: I cant enter commands in the terminal!

Fri Jul 08, 2016 2:09 pm

how did you start the server automagically
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

hello world :-)
Posts: 121
Joined: Sat Nov 14, 2015 7:12 am
Location: England, in an insecure cloud, ie. The Interwebs
Contact: Website Yahoo Messenger AOL

Re: I cant enter commands in the terminal!

Sat Jul 09, 2016 7:01 am

I once experimented with starting a Minecraft PE server with rc.local (with & after the start server command), but the lines of text the server output when starting were mixed up in the boot process, and I couldn't control the server console, so instead I opted to autologin to the desktop, and added lxterminal with the server start command to the lxde-pi autostart programs, but I suppose I could have just auto-logged in to the terminal and put a line at the bottom of ~/.bashrc with the command to start the the server, although that would have taken over every terminal session of the user.
I do moral support. Here: https://www.raspberrypi.org/forums/search.php?search_id=egosearch
I know I use too many parentheses. Problem?
Topics I have posted in: http://bit.ly/1NbDdr5
My topics: http://bit.ly/1ObnKqQ
All my posts: http://bit.ly/1OHzje7

HerringTin
Posts: 3
Joined: Fri Jul 08, 2016 11:10 am

Re: I cant enter commands in the terminal!

Sat Jul 09, 2016 11:06 am

RaTTuS wrote:how did you start the server automagically
I edited rs.local like the comment below

User avatar
rpdom
Posts: 17547
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: I cant enter commands in the terminal!

Sat Jul 09, 2016 11:09 am

HerringTin wrote:
RaTTuS wrote:how did you start the server automagically
I edited rs.local like the comment below
What exactly did you put in rc.local?

User avatar
RaTTuS
Posts: 10574
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: I cant enter commands in the terminal!

Mon Jul 11, 2016 6:38 am

hello world :-) wrote:I once experimented with starting a Minecraft PE server with rc.local (with & after the start server command), but the lines of text the server output when starting were mixed up in the boot process, and I couldn't control the server console, so instead I opted to autologin to the desktop, and added lxterminal with the server start command to the lxde-pi autostart programs, but I suppose I could have just auto-logged in to the terminal and put a line at the bottom of ~/.bashrc with the command to start the the server, although that would have taken over every terminal session of the user.
from my how to auto run a script [which I seriously need to make edits to now]
....
then edit .bashrc on that user
and right at the end put something like :-

Code: Select all

if [ $(tty) == /dev/tty1 ]; then
   ./script
fi

where script is the script you want to run.


so what happens is when the RPi is booted the 1st terminal will run your script - other terminals will want a login and if you login with your normal user will not auto run your script
if your script exits then you will be left at a command prompt, if you exit it will run again
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

Return to “General discussion”