Detach running programe from bash [closed] - bash

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I'm often in the situation that I run a linux task but then I have to leave the computer or shutdown the notebook, and the task I ran from putty has not finished yet.
Is there a way of I can quit putty and leave the process running 'til it's finished?
I know I can use screen etc, but now I already started the command w/o screen.
(please don't bother too much I didnt directly ask on superuser, serverfault or unix SO.)

Press Ctrl-Z to put the command to background.
Run bg to run it from being suspended.
Then run disown to disown the process from the parent.
It actually also depends on how your command works. Some command exits when it loses its terminal. If that's the case, you can really only just run it with screen or use nohup command </dev/null >/dev/null 2>&1 &.
One way to run it with screen could be screen -dm command.

Related

how to run a server in one terminal and open another terminal and run the client using bash scripting? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
i use ubuntu 20.04,using bash shell scripting i want to run the server in one terminal and open another terminal and run the client.I tried by using gnome-terminal it doesnt solve the problem.
#!/bin/bash
cd clustermanagement
go run server/main.go
gnome-terminal -x sh -c "go run client/main.go;bash"
i tried with other commands like gnome-terminal --bash -c "go run client/main.go; bash"
it didn't work.
the server starts running and then if press Ctrl+c and stop the server then only the client is running.
i want server to run and automatically a new terminal should be opened and client should run!
why not try running the server in the background using '&'
EDIT: looks like #Marc got to it first.

How to Exit An App in Terminal While Leaving it Running in Background [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I learned how do to do this in my Linux class last year, but can't for the life of me remember how to do it. I've google searched probably about 30 different combinations of words to try to find out how, but nothing is turning up the correct search.
I'm trying to recall how to close an application (Like pico or emacs) and leave it running in the background.
Additionally, it might be nice to know how to pick that app back up where I left off, which I never learned. Any help would be much appreciated.
When using Bash and some other shells, you can use Ctrl+Z suspend a program then run "fg" to bring it back to the foreground. If you want the program to continue running in the background, typing "bg" will resume the process. If the process prints any output while it's in the background, your display will probably end up being mangled.
For simple commands, instead running your application directly, call it using nohup like this:
nohup ./myScript.sh &
Or alternatively for something like complex like emacs, you can use screen.

Detach from spring-boot screen in ubuntu [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I am running a spring-boot project by using following command
spring-boot:run
It's running perfectly.My question is how to detach from that screen?
I have tried Ctrl+A followed by D. It's not working.
If I close the terminal the application is also shutting down.
I have tried also Ctrl+A followed by Ctrl+Z. It's also not working.It's stopping the application by force not detaching.
Any other ways?
Best thing you can do is run the command in background and then take a look at log file separately. As Madusanka said, you can run in background by adding '&' at the end of the command
spring-boot:run &
Else you can tail it to a file,
spring-boot:run >> /tmp/log.txt &
or, as Kryger says, user CTRL+Z to run in background and type bg.

Cygwin sshd use cmd instead of bash upon login via PuTTY [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I've finally got to the point where I can successfully SSH into my server, but commands like 'rake' and 'bundle' don't work! I'd rather be taken to cmd than bash upon login. Is there a command I can put into PuTTY's "Remote Command" box so that cmd gets loaded? I tried "-c cmd" but it just closes upon a successful connection. If I leave it out and just type 'cmd' when the bash prompt is ready it works ok. Also another thing of note is that user environment variables in Windows don't get transferred to the SSH session (like GIT_SSH).
Nothing was working, but I came across something which sort of made sense when browsing the passwd file for another problem I was having. The last part of the line indicates what is executed upon login. Originally it was /bin/bash, so I changed it to the cmd executable and it works now.
ex)
Administrator:unused:[SID-STUFF]:U-POS-SERVER\Administrator,[SID-HERE]:/cygdrive/c/Users/Administrator:/cygdrive/c/windows/system32/cmd

Use "nohup" to run "top" command in background [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have problems in using nohup to run top command in the background. First, I run it locally, as
nohup top &
it complains in nohup.out with text top: failed to get tty. My ultimate goal is to run top on remote machine, like
nohup ssh -t user#hostname top &
currently, the above command also fails with
Pseudo-terminal will not be allocated because stdin is not a terminal.^M
TERM environment variable not set
Any ideas?
PS: I run this command to ping machineB from machineA. machineA is always alive, but not not always logged in.
Have you tried the -b (batch mode) switch of the top command?

Resources