Questions tagged [nohup]

nohup is a POSIX command to ignore the HUP (hangup) signal, enabling the command to keep running after the user who issues the command has logged out.

nohup is a POSIX command to ignore the HUP (hangup) signal, enabling the command to keep running after the user who issues the command has logged out. The HUP (hangup) signal is by convention the way a terminal warns depending processes of logout.

717 questions
11
votes
3 answers

Why docker exec is killing nohup process on exit?

I have running docker ubuntu container with just a bash script inside. I want to start my application inside that container with docker exec like that: docker exec -it 0b3fc9dd35f2 ./main.sh Inside main script I want to run another application with…
Marek Smigielski
  • 341
  • 1
  • 2
  • 9
11
votes
4 answers

Find the Process run by nohup command

I run a server executable in Centos using the following command "nohup server &". Now I need to kill the process "server". But I tried "ps -a" command to get the PID but I couldnt get the process. Now how to kill the "server" now?
2vision2
  • 4,933
  • 16
  • 83
  • 164
11
votes
9 answers

Run SCP in background and monitor the progress

I'm running an scp command in the background: nohup scp file.gz root@target-host:/root/ > nohup.out 2>&1 I entered the password - I hit ctrl-z to halt the command and restarted it with bg, and I can confirm that it's running by executing jobs.…
Tamas
  • 10,953
  • 13
  • 47
  • 77
10
votes
2 answers

is it possible to use variables in remote ssh command?

I'd like to execute several commands in sequence on a remote machine, and some of the later commands depend on earlier ones. In the simplest possible example I get this: ssh my_server "echo this is my_server; abc=2;" this is my_server abc=2: Command…
craq
  • 1,441
  • 2
  • 20
  • 39
10
votes
5 answers

How do I run nohup as a different user without spawning two processes?

I'm trying to nohup a command and run it as a different user, but every time I do this two processes are spawned. For example: $ nohup su -s /bin/bash nobody -c "my_command" > outfile.txt & This definitely runs my_command as nobody, but there's an…
Apothem
  • 405
  • 1
  • 5
  • 12
10
votes
2 answers

nohup error no such file or directory

I am trying to run a string of nohup commands to get server statistics. However I get an error of 'No such file or directory'. Note that the 3 nohup calls are embedded in a script which is executed through a cron job. And the first nohup works but…
Switch
  • 131
  • 2
  • 4
  • 13
9
votes
3 answers

nohup: run PHP process in background

i try to run php processes in background and start this from an php file. Some informations: PHP Version 5.2.17, php safe_mode is off, linux system. I start the process with exec, tried already shell_exec. I set all files to 0755, 0777. $pid =…
stoe
  • 93
  • 1
  • 1
  • 4
9
votes
3 answers

How does nohup work?

What is performed behind the scenes when a program runs with nohup? Is the PID of the parent process being changed? Thanks. EDIT: I understood that nohup (and disown) causes that SIGHUP is not sent to the process if the parent process receives it.…
rkellerm
  • 5,362
  • 8
  • 58
  • 95
9
votes
1 answer

How do I detach python script run from Pycharm so it keeps appending to files?

I am working on a remote system and I use Pycharm remote window to edit and run my scripts. I login using ssh -Y myName@myMachine Then I run Pycharm from terminal. I want to run my scripts from Pycharm in such a way, that if I close it (and…
Natalia Zoń
  • 980
  • 2
  • 12
  • 22
9
votes
5 answers

How do I know if a bash script is running with nohup?

I have a script to process records in some files, it usually takes 1-2 hours. When it's running, it prints a progress of number of records processed. Now, what I want to do is: when it's running with nohup, I don't want it to print the progress; it…
Gary
  • 4,495
  • 13
  • 36
  • 49
8
votes
2 answers

How can I see what processes are running on a remote ubuntu server and kill them?

I started some processes with nohup and they aren't working correctly so I need to find and kill them but I dont know the pid or anything.
fancy
  • 48,619
  • 62
  • 153
  • 231
8
votes
5 answers

Nohup take no effect when to close the terminal end the process running in background?

nohup command & can keep a command running after closing the terminal. I want to play all mp3 music in directory Music. ls Music/*mp3 |xargs -d "\n" mplayer ls Music/*mp3 can list all mp3 files in directory Music, send it via pipe with xargs, -d…
showkey
  • 482
  • 42
  • 140
  • 295
8
votes
1 answer

What's the best approach to keep node running in the background - nohup vs. forever vs. pm2?

I've read many posts that talk about keeping node running in the background using nohup, forever and pm2. But I'm still uncertain which is the optimal choice and would appreciate some guidance. Background - running a MEAN stack app on an Apache…
coder101
  • 383
  • 4
  • 21
8
votes
1 answer

Is there a way to restore/recover nohup to see the output in the console?

I know chances are extremely low, but is there a way to see what a nohup-ed process has been outputting recently? I still have this process open but I've run it with redirecting all output to /dev/null. So is there a way to recover such process back…
Itako
  • 2,049
  • 3
  • 16
  • 19
8
votes
2 answers

nohup does not work properly

I have a very simple bash script. I want this bash script to continue running after I log out from the terminal since it is monitoring some services. However, I have the problem that as soon as I exit the terminal the process is terminated. I run…
nikosdi
  • 2,138
  • 5
  • 26
  • 35