Skip to main content

Questions tagged [background-process]

A 'background' process is a computer process that runs "behind the scenes" (i.e. in the background) and without user intervention. Typical tasks for using such processes include logging, system monitoring, scheduling, and user notification. Use this tag for any questions about background processes.

Filter by
Sorted by
Tagged with
0 votes
2 answers
94 views

Can I reuse a loop variable for a background task in a loop in bash?

I have an array, a=(...), and a function, b {}, which takes an argument. I want to build a loop for i in ${a[@]} to traverse the values of a. In the loop, I use commands like (b $i) & to multitask....
Alan Gatsby's user avatar
1 vote
1 answer
63 views

How to place a qemu vm in background (it means that it should run between the processes but nothing should be shown on the screen)

I would like to run the qemu vm that you see below runs between the processes,so I don't want to see any monitor,graphic,terminal window,nothing should be shown on the screen. /usr/local/bin/qemu-...
Marietto's user avatar
  • 549
0 votes
1 answer
32 views

How to detach a piped command from the terminal?

I want to allow the leading program(s) to operate in a standard manner and detach from the terminal once a graphical application launches. In this example fzf reads paths from a file, feeds the ...
user598527's user avatar
0 votes
1 answer
53 views

Linux server accessing a background process started at bootup

before I explain my issue I should mention that I'm relatively new to Linux so please forgive my ignorance. I'm using an old Dell E10S to act as a dedicated Minecraft server.  I managed to install ...
Lexus's user avatar
  • 1
0 votes
1 answer
25 views

When does a hup signal affect the parent process? [duplicate]

If I run ./script.sh &, where script is the following: #!/bin/bash echo "hello" sleep 30 echo "hello again" sleep 30 touch /root/foo.txt Then I use ps au, to identify the &...
Thomas Stokes's user avatar
0 votes
1 answer
59 views

Prevent defunct of child process when systemctl exits

I have 1 service registered with systemd open_ssh.script autossh -M 0 -L 8080:127.0.0.1:8080 -i .ssh/id_rsa USER@HOST -fN auto_open_ssh.service [Unit] Description=SSH Tunnel Service After=network....
Hoang Anh Nguyen's user avatar
0 votes
0 answers
51 views

How to run a process in the background using a bash script? [duplicate]

When I run the command in the terminal: sudo badvpn-tun2socks --tundev tun0 --netif-ipaddr 10.0.0.2 --netif-netmask 255.255.255.0 --socks-server-addr 127.0.0.1:8080 I get a terminal with packet data ...
moninah's user avatar
  • 15
14 votes
2 answers
2k views

Run two scripts after each other in the background? && and & don't work?

I want to run two shell scripts after each other, in the background, preferably also using nohup. I start with % nohup a.sh & This runs a in the background. % nohup a.sh && nohup b.sh ...
d-b's user avatar
  • 1,937
0 votes
1 answer
160 views

How to pass the standard input of a shell script to a background command

In a shell script, I am trying to start a background command that has the same stdin as that of the shell script. #!/bin/sh # ... the-program & However, the-program above will not have access to ...
Flux's user avatar
  • 2,978
5 votes
3 answers
936 views

Open PDF from a command line and go back to the command line

I would like to open a PDF with evince from the command line and after the Evince window pops up, I want to go back to the terminal command with $ already waiting for the next command. Now if I run ...
Fibo Kowalsky's user avatar
1 vote
1 answer
60 views

Background process is not being terminated by SIGINT when executed via ssh

I was experimenting with ssh, nohup, bg etc. I started a tail process in remote using $ ssh remotehost '{ nohup tail -f ut.log &> /dev/null < /dev/null &} && echo $!' It ...
Sourav Kannantha B's user avatar
0 votes
2 answers
304 views

How to disown a command in the busybox shell?

I'm trying to write a quick-and-dirty shell script daemon to run on a home router that has a busybox shell, which doesn't support disown. Is there any way to do either of the following? Run a command ...
joshlf's user avatar
  • 365
0 votes
0 answers
90 views

Can't restart a suspended process

I execute a long running Python-process. To stop the annoying noise from the fans I use AppPolice to prevent this process from using more than 20 % CPU (I don't care when it finishes). I think that ...
d-b's user avatar
  • 1,937
0 votes
1 answer
50 views

Why does Unix background process termination line not print right after termination?

So as an example if I run: sleep 1 & sleep 2 & sleep 3 I will immediately get the process IDs e.g. [1] ... [2] ... and then the shell freezes until the sleep 3 finishes running and then ...
borna morasai's user avatar
0 votes
1 answer
70 views

Reasons for stty -tostop having no effect [duplicate]

I am trying to get a background process to print to the terminal. I haven't seen anything that otherwise indicates there is anything else to do besides stty -tostop. Am I missing something? Running ...
Sterling Butters's user avatar
0 votes
0 answers
48 views

Why does bash send SIGTERM to program after logout despite setting nohup and disown

I want to run a program which continues after logout from an ssh session. I've tried: nohup myProg > /tmp/logfile 2>&1 & disown %1 and systemd-run --scope --user myProg -p > /tmp/...
Danny's user avatar
  • 613
0 votes
0 answers
35 views

Mirroring files locally in background

Context: Say I have two workplaces. Currently, I carry a laptop along, and have external HDs staying in these workplaces to hold backups. Now, I'm given the opportunity to have a desktop in both ...
L. Levrel's user avatar
  • 1,503
1 vote
2 answers
511 views

Does any terminal multiplexer (screen, tmux, zellij) support job suspension (Ctrl-Z) in Bash?

As far as I've seen, pressing Ctrl-Z on any terminal multiplexer, or trying to start them in the background, does nothing or crashes. I know that, in a sense, terminal multiplexers are a "...
Sebastian Carlos's user avatar
0 votes
2 answers
1k views

How to write a process that restart again every time that it's killed

I want the exact opposite of this question. I want to know how I can create a process that keeps restarting if it's killed. Could someone give me an implementation example? For instance, let's assume ...
locnnil's user avatar
0 votes
0 answers
59 views

Unmount user home directory in a delayed background process after logging out

The home directory of user bob is mounted by a superuser from elsewhere. bob himself is a sudoer, he is logged in and is happily using his mounted home directory. He finishes his work and wants to run ...
Greendrake's user avatar
28 votes
2 answers
6k views

Why does "yes&" crash my Bash session?

"Yes, and..." is a wonderful rule-of-thumb in improvisational comedy. Not so much in the UNIX world. When I run the admittedly silly yes& command, I cannot interrupt it. The terminal ...
Sebastian Carlos's user avatar
1 vote
2 answers
2k views

What is the "correct" way to run a systemd service which spawns long running detached processes?

I have a systemd service which spawns an ffmpeg process any time it detects a new event. These processes are meant to survive and run to completion even if the service is restarted (hence them being ...
plunker's user avatar
  • 77
0 votes
0 answers
701 views

Embed script into docker container to run after main process starts

For a particular docker image (based on alpine) I want to run some custom code after the container starts. I want that code inside the container, so it's easy to use and everything is self-contained. ...
lonix's user avatar
  • 1,773
-1 votes
1 answer
139 views

Strange mysqld process on my system wont let port 3306 be free

I am using ubuntu Jammy release and on my system port no 3306 is unusable since I tried ssh based port forwarding on the same to a different machine. Also while running ps -aux it shows a strage ...
Gautam's user avatar
  • 121
2 votes
2 answers
392 views

Bash wait command actually gets result from background job cache, would the cache cause memory leak when it creates background jobs continuously?

I was checking possibilities of pid leaks about a bash script which continuously create background jobs yet not call wait command, I happened found (by strace) that Bash monitors SIGCHLD and ...
osexp2000's user avatar
  • 532
0 votes
1 answer
332 views

How can I have "names" for my background processes (not just the command)?

I run a lot of vim windows, and often put them in the bg. The problem is that they all say vim when I list jobs so it's hard to distinguish. [1] - suspended nvim [2] - suspended nvim [3] + ...
pixelearth's user avatar
0 votes
1 answer
227 views

Writing a ksh-script with a predefined time-out

My OS is AIX (7.2) and my shell is ksh88 (preferably) or ksh93, if necessary. I want to write a script that sets some maximum timer for its execution. If it manages to finish its task within this time ...
bakunin's user avatar
  • 531
1 vote
1 answer
80 views

Does POSIX sh require expanding $! in order to keep a reference to the child process?

Spec According to this online POSIX Spec, in Shell & Utilities, Shell Command Language, Section 2.9.3 Lists has the following to say about Asynchronous Lists: When an element of an asynchronous ...
D. Ben Knoble's user avatar
0 votes
1 answer
129 views

Is it possible to defer reaping of background processes in bash?

If I just run sleep 1 & in bash, the sleep process will get reaped almost instantly after it dies. This happens whether job control is enabled or disabled. Is there a way I can make bash hold off ...
Joseph Sible-Reinstate Monica's user avatar
1 vote
2 answers
163 views

Is there a performance penalty for backgrounding a process?

If I do: sleep 1 versus sleep 1 & wait $! will there be any difference in terms of CPU usage for spawning a foreground process versus a background process? Or will the performance of both lines ...
Maestro's user avatar
  • 191
0 votes
1 answer
106 views

Sleep vs tail to wait on process

Currently I do: while [ -d "/proc/$PID" ]; do sleep 1 done To wait for a process to exit. If I would replace it with: tail --pid=$PID -f /dev/null Would that be more efficient for the ...
Maestro's user avatar
  • 191
0 votes
3 answers
90 views

bash -c "exec -a myProcessName ./script.sh &" doesn't send that script into backgound

From a bash script, I need to start three processes and put to each of these processes a name, in order to be able to stop them in a later stop command. # Démarrer les applications eco emploi : ...
Marc Le Bihan's user avatar
6 votes
2 answers
1k views

bg command not sending process to background

After pausing the process with ctrl-z, I attempted to send it to background with bg command. Unfortunately, the process isn't sent to the background, and reappear to be running foreground. Then, I do ...
Faxopita's user avatar
  • 179
1 vote
0 answers
80 views

Background process does not show up in ps

I used ssh to start a dotnet app as background job on a remote server dotnet MyApp.dll & I confirmed, that the app was running and then terminated the ssh session. Now I want to kill this ...
AracKnight's user avatar
0 votes
1 answer
72 views

Find out if a process was kicked off in the background or got backgrounded mid-run

I'm interested in Linux specifically, but an answer for other Unices would be great as well: Does the system have a way of signaling to a process that it's been launched in the background? In other ...
Joseph R.'s user avatar
  • 39.8k
0 votes
1 answer
198 views

How to NOT append nohup output to a file but replace it?

Lately I needed to be able to run a script in the background and monitor its output from another machine. For this reason I was able to use this command: $ nohup ./rsync.sh > ./output.txt This is ...
Martin Zeltin's user avatar
0 votes
1 answer
190 views

Why is /bin/bash /entrypoint.sh /run.sh always running?

From the moment I turn on my laptop (Ubuntu) and run htop to observe running processes, there are always these four that seem to spawn from the following command: /bin/bash /entrypoint.sh /run.sh I ...
Ege Karaismailoglu's user avatar
0 votes
1 answer
125 views

Run a command in background and independent of terminal and run alternative if fails

Goal: To run a command independent of the terminal and return immediately. And if the command fails run an alternative commands independent of the terminal and return immediately. I did the following. ...
Porcupine's user avatar
  • 2,056
0 votes
1 answer
3k views

What does the error stty: 'standard input': Inappropriate ioctl for device Can't obtain kerberos tickets mean?

I ran the command: nohup sh -c "echo $SU_PASSWORD | /afs/cs/software/bin/reauth; python -u ~/diversity-for-predictive-success-of-meta-learning/div_src/diversity_src/experiment_mains/...
Charlie Parker's user avatar
3 votes
0 answers
145 views

Why do backgrounded commands in Zsh functions not show correctly in jobs?

In Bash 5.2, the output of jobs after either of the following is identical modulo job numbers: sleep 3 # press C-z s() { sleep 3; } s # press C-z In both, jobs produces something like [1]+ Stopped ...
D. Ben Knoble's user avatar
2 votes
1 answer
446 views

How does one send new commands to run to an already running nohup process or run two commands together/concurrently in nohup?

I want to run a nohup job and to that already running process run a specific new command (e.g. kerberos authentication). In fact the ideal solution would be to first run the reauth command and then ...
Charlie Parker's user avatar
0 votes
2 answers
1k views

How do I wait for a process to end and then do a series of actions (e.g. kill a tmux session) without blocking my main terminal?

I am trying to "re-implement" nohup inside of tmux (so dispatching a job without blocking me and then killing the tmux command acting as nohup). My attempt is here (and it has several issues ...
Charlie Parker's user avatar
1 vote
1 answer
3k views

How to run a job in the background using tmux without interacting with tmux (like dispatching a nohup job)?

Due to me having to re-authenticate with Kerberos I need to run my long lived processes in tmux. I wrote a script that I thought would work but it didn't. The issue is that after I run the tmux ...
Charlie Parker's user avatar
0 votes
2 answers
529 views

Can't Ctrl-C a script after controlling it from another terminal

I'm running blah.sh in one terminal. Then in another terminal, I'm running a script that suspends and later continues blah.sh: ... script_id=`pidof -x blah.sh` kill -s SIGSTOP $script_id ... ...
Adam M's user avatar
  • 1
0 votes
1 answer
23 views

Mystery connections at login - how to find out what's responsible?

I have two connections that occur every single time I login (GUI KDE). They disappear after about one minute. I want to know what they're telling who. So to get started, how do you take connections ...
idonteven's user avatar
  • 195
3 votes
1 answer
491 views

What is the "kaluad" process on Linux?

I have been browsing running processes on my PC, and I found a process with a name "kaluad", at the time with PID 196 running under root with priority -20. I can't find it in any ...
Kryštof Jelínek's user avatar
2 votes
3 answers
2k views

How to run a command in background job and wait for result in a bash script

How can I spawn a process for a particular command and while it is running capture its output? For example I want to perform dd on a block and while it is doing its job and producing status message , ...
DEKKER's user avatar
  • 968
0 votes
0 answers
9 views

Process in background is stopped [duplicate]

I want to put a program in the background. I start it by executing ./IpLocations. Then I suspend it with Ctrl + Z. When I call bg the program is in the background but it's still in Stopped state. The ...
user544458's user avatar
6 votes
1 answer
1k views

Why jobs lost when after reconnect ssh?

I have a job that runs in the background via ctrl + z and bg, and after reconnecting ssh I cannot find that job in the jobs command but can find it in ps grep. For now, I searched this and I get the ...
Yang Xu's user avatar
  • 93
2 votes
1 answer
763 views

Unable to run flatpak independent of the script that started it

I've always successfuly used an ampersand to start an application in the background from within a script. Such background applications seem to be detached from the script that started it, meaning that ...
wayan's user avatar
  • 91

1
2 3 4 5
13