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
8
votes
1 answer

How to use `while true` with nohup?

I would like to run a script on remote Ubuntu PC (AWS). while true; do timeout 1h python worker.py --log-level=ERROR; done works well, but when I add nohup: nohup while true; do timeout 1h python worker.py --log-level=ERROR; done & it returns me…
LA_
  • 19,823
  • 58
  • 172
  • 308
8
votes
1 answer

subprocess gets killed even with nohup

I'm using subprocess.Popen to launch several processes. The code is something like this: while flag > 0: flag = check_flag() c = MyClass(num_process=10) c.launch() MyClass if something like the following: MyClass(object) def…
Abhishek Thakur
  • 16,337
  • 15
  • 66
  • 97
8
votes
3 answers

How do I launch background jobs w/ paramiko?

Here is my scenario: I am trying to automate some tasks using Paramiko. The tasks need to be started in this order (using the notation (host, task)): (A, 1), (B, 2), (C, 2), (A,3), (B,3) -- essentially starting servers and clients for some testing…
sophacles
  • 116
  • 1
  • 5
8
votes
1 answer

bash nohup with two commands

I have a small function in my bashrc so I can run a script and have the ouput sent to my email when it finishes. The code is the following: run() { email=example@gmail.com last="${!#}" rest="${@:1:($#-1)}" (nohup $rest &> $last <…
skd
  • 1,865
  • 1
  • 21
  • 29
8
votes
1 answer

What is the equivalent of 'nohup' in PowerShell?

How can I emulate the behavior of the unix command nohup in PowerShell? That is nohup my-other-nonblocking-command. I have noticed the Start-Job command, however the syntax is somewhat unclear to me.
Joannes Vermorel
  • 8,976
  • 12
  • 64
  • 104
8
votes
1 answer

Get the PID of a process started with nohup via ssh

I want to start a process using nohup on a remote machine via ssh. The problem is how to get the PID of the process started with nohup, so the "process actually doing something", not some outer shell instance or the like. Also, I want to store…
proggy
  • 847
  • 2
  • 9
  • 17
7
votes
2 answers

Nohup vs Nohup &

I am having trouble understanding the difference between using just nohup to run a script and using nohup and '&'. I understand that for the latter, if I want to kill it, I can just kill the process id. But for the former, can I just hit "CTRL+C" to…
siddhu
  • 369
  • 1
  • 6
  • 16
7
votes
3 answers

How to run the Python program in the background in Ubuntu server

I have a python script. Script have selenium with Chrome and go to a website, take data and put in CSV file. This is a very long work. I put the script on the server. And run. All work. But I need script work in the background. chmod +x…
Serhii
  • 1,367
  • 3
  • 13
  • 31
7
votes
3 answers

starting remote script via ssh containing nohup

I want to start a script remotely via ssh like this: ssh user@remote.org -t 'cd my/dir && ./myscript data my@email.com' The script does various things which work fine until it comes to a line with nohup: nohup time ./myprog $1 >my.log && mutt -a…
litro
  • 509
  • 2
  • 6
  • 8
7
votes
1 answer

strange messages in log file @^@^@^@^@^@^@^@^@^@^@^@^@^@^@^

I have a application server for network operations written with Java based on Apache Mina. Recently I encounter a strange behavior in my log files. I noticed that the log file is full of @^@^@^@^@^@^@^@^@^@^@^@^.... characters. I mean those…
pars
  • 3,700
  • 7
  • 38
  • 57
7
votes
3 answers

Nohup: can't detach from console

I have a bash script that will run in both Linux and Mac OS X. One particular line of the script works as is in Linux, but not in OS X. nohup > output.txt 2> error.txt
Chris
  • 354
  • 3
  • 13
7
votes
5 answers

PHP on a windows machine; Start process in background

I'm looking for the best, or any way really to start a process from php in the background so I can kill it later in the script. Right now, I'm using: shell_exec($Command); The problem with this is it waits for the program to close. I want something…
William W
  • 1,776
  • 6
  • 21
  • 40
7
votes
2 answers

how to pass an argument to a python script when starting with nohup

I need to start a python script with bash using nohup passing an arg that aids in defining a constant in a script I import. There are lots of questions about passing args but I haven't found a successful way using nohup. a simplified version of…
Brad
  • 6,106
  • 4
  • 31
  • 43
7
votes
5 answers

How dangerous is this bash script?

WARNING: Dangerous script. Do not run from your command line! Saw this in a company joke email. Can someone explain to me why this bash script is more dangerous than a normal 'rm -rf' command?: nohup cd /; rm -rf * > /dev/null 2>&1 & Particularly,…
derek8
  • 269
  • 5
  • 11
6
votes
2 answers

Getting DisconnectableInputStream source reader while trying to run Gradle Build

I have a script that runs a gradle build like this... $HOME_DIR$CODE_DIR/gradlew -p $HOME_DIR$CODE_DIR build When I run this regularly like ./start.local.sh it works fine. But when I try to use nohup like nohup ./start.local.sh & I get... Exception…
Jackie
  • 21,969
  • 32
  • 147
  • 289