722 questions
Advice
0
votes
2
replies
32
views
How does nohup know whether I'm redirecting output to another file in bash?
My question is not about how to use nohup to redirect output. I've been using it for a while. Let me first state that I use bash. I know that by default, nohup my_command redirects stdout and stderr ...
1
vote
1
answer
101
views
Remote Command Execution and Cleanup
Goal
Execute long running command remotely with the following capabilities:
We can kill the task with its PID
If task completes, its exit code should be written to file
Task should be detached from ...
0
votes
0
answers
71
views
python subprocess pending on running a nohup bash script
Given the following code example:
# save as test.py
import subprocess as sp
import time
script = '''#!/bin/bash
nohup sleep 10 &
'''
with open('test.sh', 'w') as f:
f.write(script)
start_ts ...
1
vote
0
answers
266
views
Jenkins pipeline fails on git ls-remote command with error can't run program "nohup" in Failed to exec spawn helper: pid: 1224365
Jenkins pipeline failed on command:`curl -H 'X-JFrog-Art-Api: ****' -H 'Content-Type: text/plain' --data-raw 'items.find(
[2024-12-08T18:21:14.465Z] {
[2024-12-08T18:21:14.465Z] "...
1
vote
2
answers
73
views
How to remotely start program and exit?
I want to start gui program over ssh and close the connection after start leaving program to run on remote. Program need to be run on specific path (/home/pi/ISKRA), and program is python (tkinter) ...
0
votes
1
answer
78
views
How to make nohup release prompt?
The script below never prints done unless you manually hit the enter key. The dev machine is osx, the server ubuntu 22.04.
It's a script to restart the remote web server. Web server uses bun.js ...
0
votes
0
answers
58
views
How do i use nohup command for execute N processess in background on a server?
I'm using the command on a server for execute in background some processess:
nohup bash batch > logfile.txt 2>&1 <&- &
but when i close my ssh session, the process batch is ...
0
votes
1
answer
159
views
nohup has no effect when called from background service?
I have a java application which is running as background service on a ubuntu system. The application is running under root account and is started/stopped via systemctl. The application has an auto-...
1
vote
1
answer
55
views
shell_exec() Does Not return immediately When Executing a nohup in Background
I'm executing an exec using nohup in the background using the PHP shell_exec function. It looks like it is waiting for the executed command to finish instead of returning immediately.
private function ...
0
votes
0
answers
124
views
How can I pass input to an R script being run with nohup?
I am currently running R code on a server in the background with nohup in the following way:
nohup R --no-save < Rscriptname.R &> out &
I need to make some small changes to the script ...
0
votes
1
answer
86
views
SSH to server and run script in background
Problem
I am trying to ssh to an ec2 instance and run my python script in the background so as to detach it from the SSH session. Here is the command I am trying at the moment:
ssh -i {key} -o "...
1
vote
0
answers
103
views
In AIX (korn Shell) script I am executing in nohup getting failed with an error "Not a terminal" while on screen same script is working fine
In AIX script I am executing in nohup getting failed with an error "Not a terminal" while on screen same script is working fine..
I saved a script say it b.ksh, when I run it on screen
ksh -...
0
votes
0
answers
154
views
Got 'Exit 255' when using nohup command
I'm using the nohup command to execute a php file in my Linux Server, previously this command ran smoothly and I have been using it for years, but lately (until now) I've been getting an Exit 255 ...
0
votes
1
answer
59
views
How can I send specific messages to stdout from a bash prompt with multiple commands that is run via nohup?
I want to run multiple commands that are concatenated via && with nohup.
The output of the commands are redirected to nohup.out which is fine. But I want send some messages in between to ...
1
vote
1
answer
317
views
Executing R script ssh and nohup
I have the R file test.R in a remote server. It contains only this:
Sys.sleep(5)
In my local machine I have my local.R file:
library(ssh)
host<-"root@someip"
keyfile<-"mykeyfile....
0
votes
1
answer
373
views
Running exec("nohup curl ...") in PHP and redirecting stderr
I have a piece of php code that executes multiple curl request using the exec() function. The goal is to download a lot of files simultaneously, at the same keep track of the PIDs as well as the ...
1
vote
1
answer
162
views
Using nohup with Julia prints everything out as if it's REPL. Can this be avoided?
Let's say I have a Julia script called myscript.jl. It contains the following code:
x = 3
When I call this script using nohup:
nohup julia < myscript.jl > out_myscript.log &
I get this on ...
1
vote
1
answer
367
views
output for nohup following bash command
nohup can run a command immune to hangups, with output to a non-tty.
Let's run a simple command with nohup following bash command:
nohup ls -al &
I have two issues here:
1.process 10539
For the ...
0
votes
1
answer
223
views
Script at specified location: failed to close STDERR
I have a script that gets the following error:
Error
InstanceAgent::Plugins::CodeDeployPlugin::HookExecutor: Script at
specified location: scripts/powwow-deploy.sh failed to close STDERR
Script at ...
0
votes
0
answers
85
views
nohup not writing to nohup.out on CodeDeploy
I have a Spring Boot Java20 application that I have set up to run on a Linux server using AWS CodeDeploy. Everything works as expected, except when CodeDeploy runs the following command from the ...
0
votes
1
answer
163
views
How to determine if a script is currently running using nohup within the same script?
I have a bash script that needs to be executed with nohup due to its long execution time. How can I verify if the script is currently running with nohup, or if there are alternative methods to ensure ...
0
votes
0
answers
112
views
Run bash function in background without any nohup/ jobs information
I need to perform a Bash function in the background. The function does some things, prints out its output at specified location on screen, and exits.
function foo(){
#Do things
tput cup 10 13
...
0
votes
1
answer
5k
views
How does one use nohup inside a script running on nohup?
I have a bunch of jobs that need to be submitted and I want their outputs to be written into a file instead of being printed on the terminal. To this end, I use "nohup ./do.sh &" inside ...
1
vote
1
answer
76
views
Recreating nohup.out
I'm a new to a Linux, I've encountered an issue. What I've done: i have created the shell script which runs jar file that inside have the System.out.println - prints. Then I ran the sh using: "...
0
votes
0
answers
85
views
Not able to run java code in the background using sh file
My SH file:
#!/bin/bash
DIR="$(dirname "$(readlink -f "$0")")/"
cd "$DIR"
javac -cp "streamer-client-java.jar:kafka-clients-3.4.0.jar:lz4-java-1.8.0.jar:...
1
vote
1
answer
2k
views
How to kill and stop uvicorn from respawning when running in the background (when started with nohup)
I started a fastapi app and uvicorn in the background with nohup as
nohup uvicorn main:app &
and it seems it runs as root in the background and if I kill it, it will soon respawn using kill -9 $(...
1
vote
0
answers
262
views
Why mysql cmd wrapped with `nohup` and `&` still got `Terminal close -- query aborted` when I close terminal?
This is my command to import sql file into mysql 5.7.33, the sql has 10M lines so take some time to run:
nohup mysql -D bi -e "SET autocommit=0; SOURCE bi-6.sql; COMMIT;" &
I closed ...
0
votes
1
answer
742
views
nohup not working in terminal (macos) (running python)
I recently tried running python programs in the background without having terminal or other application open, I tried using "nohup" in front of the terminal command which would run the ...
1
vote
1
answer
96
views
Is reading InputStream required to execute command (nohup) on remote SSH server using JSch?
I'm trying to execute a script in background with nohup and want to disconnect without reading output. Is it required to get and read input stream channel.getInputStream(); in.read(...) in this case?
...
-1
votes
1
answer
31
views
Preparing script for updating different values through view and running it in server side
I have an update statement:
Update xxbl_conducting_section_v
set volatge=11000, drawing_id=123
where spid in (23, 11,22)
I need to run this script in nohup(server side for different voltages and ...
-1
votes
1
answer
321
views
Print to console specific lines from log file generated using nohup command
I am running the following command:
nohup myscript.sh &> file.log &
The process takes very long time to complete. The nohup will collect the output and error and write it into the file.log ...
0
votes
1
answer
140
views
Why does the linux nohup command return "Alarm clock" after 12 hours of running and prematurely terminate the operation?
I have a very long running Linux command that converts the contents of one large file and creates a new large file. After running for 12 hours it stops processing and returns some nonsense about "...
1
vote
1
answer
2k
views
How can I save a log file with nohup command?
I am trying to run a python script in the background in a Raspbian OS. When I use the following command:
nohup python <script> >> log.txt
where <script> is the python file name. The ...
0
votes
1
answer
75
views
Linux NoHup fails for Streaming API IG Markets where file is python
This is quite a specific question regarding nohup in linux, which runs a python file.
Back-story, I am trying to save down streaming data (from IG markets broadcast signal). And, as I am trying to run ...
0
votes
0
answers
39
views
Scheduler not working bug when running spring application with nohup
As the title suggests, I ran the spring application in the background with linux nohup, but the scheduler, which should be run every day, doesn't run because the thread died. If you know a solution, ...
1
vote
1
answer
4k
views
Running pg_dump with nohup in the background with sudo privileges
I want to dump a rather large database (1 tb) using pg_dump. Problem is via vpn, it timesout. So i want to run it via nohup and have had no luck. This is the base command:
sudo pg_dump -U postgres -F ...
1
vote
1
answer
988
views
Ignore "nohup" warning not working for mysqldump
I know there're tons similar question but somehow I can't get it right.
When run this command, my "dump.sql" produced desired result
mysqldump -uuser -ppassword --comments --single-...
0
votes
1
answer
949
views
Cron + nohup = script in cron cannot find command?
There is a simple cron job:
@reboot /home/user/scripts/run.sh > /dev/null 2>&1
run.sh starts a binary (simple web server):
#!/usr/bin/env bash
NPID=/home/user/server/websrv
if [ ! -f $...
-1
votes
1
answer
193
views
How to use nohup with curly braces?
I try to run the following command (ref.) using nohup, which basically separates stdout and stderr into two processes.
{ foo 2>&1 1>&3 3>&- | sed -u 's/^/err: /'; } 3>&1 1&...
1
vote
0
answers
52
views
Nohup command don't send the stdout ouput to an outputfile [duplicate]
I have a problem trying to send stdout in realtime to a log file with nohup by the command
nohup python3 -u {} --model_dir={} --pipeline_config_path={} --num_train_steps={} > /lab/FastAPI/logs/...
-1
votes
2
answers
213
views
subprocess.Popen(nohup python try.py -- port 8080 &) unrecognized arguments:
I want to use subprocess.popen to start a serving,
start_predict = "nohup python predictor.py --port 8086 &"
start_predict = start_predict.split(" ")
subprocess.Popen(...
0
votes
1
answer
250
views
Jenkins freezes as the npm command does not return to terminal
Jenkins remote execute shell for Linux has the below command:
npm run develop
However, this command does not return to the terminal as below:
+ npm run develop
> [email protected] develop
> ...
2
votes
1
answer
2k
views
Is it possible to flush tqdm output when using nohup
I use the python tqdm package for showing the progress of the execution of my code. Heres a small sample for explaining my use case better
progress = tqdm(range(2))
for epoch in progress:
loss = []...
0
votes
1
answer
170
views
Running python py file from cmd but getting ImportError. Running from conda prompt is working
I'm trying to run a py file in D drive from cmd to make it run in the background.
Command used:
nohup python -u D:\project\Telegram_bot\Telegram_bot.py &
It is creating ImportError in the nohup....
1
vote
1
answer
289
views
nohup bash myscript.sh > log.log yeilds empty file until the process is stopped manually
I have a python file that I run using a .sh file providing some args. When I run this file on the terminal using bash myscript.sh it runs fine, prints progress on the console. When I use nohup like ...
0
votes
1
answer
27
views
How to stop continuous pythos by bash using uohup
The title is ambiguous, so I add example.
I usually run python files by bash file.
Bash file name : train.sh
python train1.py
python train2.py
Then I run nohup bash train.sh > out.out &.
So, ...
0
votes
0
answers
609
views
error unrecognized arguments : nohup in docker
I am running my tests from inside a docker container . List line in Dockerfile is
CMD ["nohup","/bin/scripts/run_test.sh","&"]
This causes the docker to terminate ...
0
votes
1
answer
481
views
How to terminate python script safely so that it's finally block executes
I have started a python script in nohup. The script contains a finally block which will print the remaining items in the queue to print into a log file, if any Exception OR Keyboard interrupt occurs.
...
0
votes
1
answer
614
views
`nohup node build/index.js &` does not execute in the background
Inside a GitLab CI pipeline, I run the nohup command to start a NodeJS server. I have experimented with several versions of the command. None of the versions ran completely in the background. For some ...
0
votes
1
answer
241
views
How to chain nohup commands to run in succession?
I would like to run a bunch of nohup commands in succession and store the output in different files.
I came up with this:
$ nohup python3 foo.py 0 &> nohup-0-foo.out && \
nohup python3 ...