Use "nohup" to run "top" command in background [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 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?

Related

Have multiple arguments in CommandLine (Windows Terminal) [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 would like to setup my profile in Windows Terminal in a way that it automatically connects to server1 via ssh and using server1 it connects to server2.
Everything works fine when i connect to single server1 machine but not sure how to launch second command.
What i have is:
in settings.json->"profiles"->"list" -
"commandline": "ssh -i "mykey.pem" ubuntu#server1"
What i want to do is something like (Bellow is just for visualization, any way that gets the job done is fine)
"commandline": "ssh -i "mykey.pem" ubuntu#server1 && ssh -i "mykey.pem" ubuntu#server2"
Found Solution thanks to https://unix.stackexchange.com/questions/41493/how-to-ssh-to-a-server-using-another-server
ssh -t $SERVER_A ssh $SERVER_B
gets the job done

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.

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

Detach running programe from bash [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'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.

Resources