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
0 answers
50 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,853
0 votes
1 answer
76 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,770
5 votes
3 answers
829 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
25 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
68 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
  • 355
0 votes
0 answers
49 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,853
0 votes
1 answer
44 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
31 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
33 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
  • 553
0 votes
0 answers
29 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,473
1 vote
2 answers
237 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
336 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 ...
Lincoln's user avatar
0 votes
0 answers
48 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
543 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
268 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,669
-1 votes
1 answer
88 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
  • 111
2 votes
2 answers
250 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
  • 472
0 votes
1 answer
132 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
110 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
  • 499
1 vote
1 answer
67 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
79 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
115 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
  • 189
0 votes
1 answer
63 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
  • 189
0 votes
3 answers
85 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
986 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
  • 177
1 vote
0 answers
46 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
52 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.2k
0 votes
0 answers
41 views

Is xdotool a process running in the background? Or is it a library that is only triggered by other programs or scripts?

I looked at the github-xdotool page. It only says it's an automation tool. I am newbie/illiterate and it is my curiosity and question. If I try to install and use touchpad gesture programs, they ...
banuyayi's user avatar
  • 101
0 votes
1 answer
129 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
146 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
64 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
  • 1,772
0 votes
0 answers
113 views

How does one send a password to a command when you are not tty/stty (terminal) and don't have expect, sshpass?

I want to authenticate a process by sending my password e.g. (but fails): echo $SU_PASSWORD | /afs/cs/software/bin/reauth with error: Password for brando9: stty: 'standard input': Inappropriate ioctl ...
Charlie Parker's user avatar
0 votes
1 answer
2k 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
121 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
368 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
789 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
0 votes
1 answer
2k 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
453 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
328 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
  • 856
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
913 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
478 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
0 votes
1 answer
1k views

What exactly does it mean to run a process in the "background"?

I want to understand a little bit better, what a background process is. The question came to live as a result of reading this line of code: /usr/sbin/rsyslogd -niNONE & Source The documentations ...
Andrew Savinykh's user avatar
0 votes
0 answers
299 views

"nohup python3 .. &" ends once I disconnect from a server

This command nohup python3 main.py > my_log.log 2>&1 & will end once I disconnect from a server. That is, if I disconnect and then connect 10 seconds later, the task, or a job, will be ...
Kum's user avatar
  • 3
0 votes
0 answers
102 views

In linux, terminal closed unexpectally, but wget is continue to be run as process and to download (with proof). How I can bring it again to terminal?

In linux, terminal closed unexpectedly, but wget continues to be run as process and to download --- with proof - new files generated from website -- weird enough, log chaged from given wget_log to ...
Estatistics's user avatar
1 vote
1 answer
563 views

Does xargs -P run background processes? How is it different from using an &?

I have a file processes.txt as follows: process_1.sh process_2.sh process_3.sh I will run the following on the terminal: cat processes.txt | xargs -L1 -P3 sh How would this be different if I had a ...
sriganesh's user avatar
  • 101

1
2 3 4 5
13