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
2answers
24 views

eval variable=command in the background

I have the following code for name in a b c d; do for i in {01..12}; do eval test_${name}_{i}=`some command` done done I am trying to do the assignments in the background but it doesn'...
1
vote
1answer
24 views

zsh: Why do I get suspended background processes even when I have `stty -tostop`?

I like my background processes to freely write to the tty. stty -tostop is already the default in my zsh (I don't know why, perhaps because of OhMyzsh?): ❯ stty -a |rg tostop ...
0
votes
0answers
14 views

Centos 6: root rsync process keeps running, I cannot identify who is connecting

Running centos 6. When I look at running processes using htop, I keep seeing an rsync process running as root, and consuming CPU. I also see a root@notty process running. However, I don't have any ...
0
votes
1answer
25 views

Why do certain processes keep jumping to higher PIDs?

Sometimes when my vscode hangs up, and I have to force-quit it, it is as though it will not start back up again until I restart my computer. Before shutting the computer down I tried looking for its ...
1
vote
1answer
35 views

Cannot kill children on trap

I am stuck with something unexpected to me: I am trying to make a chat script and set to call function on 'Ctrl+Z' trap 'chat_unloop' 20 But in the code I have some rows that starts child ...
0
votes
2answers
37 views

Unable to resume execution of a background process

I tried to install git through the command line, sudo apt install git. I put that process into the background by pressing Ctrl-Z. This also stops the process's execution so I tried to resume with ...
0
votes
2answers
48 views

Why does sending a process to background set $? to a non-zero value? [duplicate]

I've just noticed that sending a foreground process to background with Ctrl-Z sets the $? variable to a non-zero value. Why is this the case? This behavior is bothering me, because I wanted to have a ...
0
votes
0answers
27 views

ps ax showing process or not [duplicate]

When I execute ps ax command with grep, it' showing a single entry of test.py test.py was just single print statement submitted like this: nohup python test.py & So I'm assuming it didn't ...
1
vote
1answer
13 views

Can't exec mplayer as a background process

If I give a command like: $ mplayer ~/sounds/mysound.wav then it works and plays a sound. If I sleep before playing the sound, then it also works: $ sleep 5s && mplayer ~/sounds/mysound.wav ...
0
votes
2answers
73 views

would like to suppress the output of pkill on a background process

I have a shell-script in which I do an iostat -c 1 > data.cpu. & Later in the script, after I've collected the data I'm interested in, I do a pkill iostat which kills iostat and allows me ...
0
votes
1answer
28 views

When I use nohup and & to run in the background, will there be any effect on my output data?

With the command: nohup python get_seq.py TPH_hits all_genomes_eukaryotes_20200303.fas > TPH_seq2.fasta & nohup: ignoring input and redirecting stderr to stdout Will there be any effect on ...
0
votes
1answer
22 views

how to alter program preferences to run in background rather than foreground [duplicate]

I have been using commands like gedit some_script.pl & for many years. However, I would like to force the program to automatically run in the background, so that I would get the command line ...
1
vote
3answers
51 views

How to use one terminal with multiple interactive jobs without stopping them?

I have two shell-scripts, say client.sh and server.sh, which has to work simultaneously and give some useful output in watch-way. And I am able to use only one terminal. So I should switch between ...
0
votes
1answer
27 views

niceness of a background process

Do background process have different nice given? I noticed it is not having the default 0. This might be a problem because it is having less priority.. does anyone know how to change this behavior? I ...
1
vote
2answers
37 views

Send process to background and disown and exit the terminal (& and && operator clash in zsh)

I need to run a process in the background and then exit the current terminal. The following command results in error: > google-chrome-stable &! && exit zsh: parse error near '&&...
2
votes
0answers
58 views

Some JVM flags stop backgrounded process unexpectedly

I've been running a local Minecraft server for my kids at home, and as more have joined, lag has become a problem...and lately, actual game crashes (when a single game "tick" takes more than 60s, the ...
0
votes
2answers
24 views

redirection while background

I wrote some program in Python that printing some message. I want that this program go to background and print its message in a file. So I wrote in bash: python program > message &. Problem: ...
0
votes
0answers
18 views

Unknown rsync and rm processes slowing down system

Unfortunately I immediately restarted my system when I looked at what the top command says about why my system is constantly freezing for a second and the hard drive sounded very busy without any ...
1
vote
1answer
70 views

Exceptions with xdg-open when starting programs in the background

Until now I've been using the alias to xdg-open. alias o='xdg-open $@ 2> /dev/null' The default behaviour for xdg-open is to start the process in the foreground of the currently selected terminal ...
0
votes
0answers
20 views

Unexpected output between two background processes

When two commands are put in the background and killed one after the other, such as in this code #!/usr/bin/env sh while true do sleep 1 printf "." done & sleep 3 kill $! while true do ...
4
votes
3answers
116 views

Log background job execution time

I have a script I execute in the background and capture all output with a command like this: nohup bash -x test.sh < /dev/null > log.txt 2>&1 & How can I find out how long it took ...
0
votes
3answers
68 views

How can I start a long running background process, via ssh, and immediately disconnect?

I want to write a bash script which can ssh into a server, start a continuous background process (infinite python script) and exit the server. Here is what I have tried: ssh user@domain "python3 ...
0
votes
1answer
51 views

Can I wait for all forked processes from a command to finish?

Suppose running FOO stars BAR in the background. How can I wait for BAR to finish in the shell? I want a solution where I don’t change the internals of FOO (though I can grudgingly change BAR’s.). ...
0
votes
0answers
95 views

High kworker CPU usage on idle embedded system

I am working on an embedded device where the kworker stays at high cpu usage when the device is idle. iostat output: bash-4.3# /intflash/iostat Linux 4.9 03/05/20 _ppc_ (2 CPU) ...
1
vote
1answer
118 views

Given a job’s pid, bring the paused job to background/foreground and running state

I am working on my own shell and I have a confusion about job management. I am able to list processes owned by a user and pause any process that its pid is given. However, as stated in title, I need ...
0
votes
0answers
25 views

Why fg command within an infinite while loop works like a “keep alive” watchdog?

Recently, I've run into this implementation of a handicraft "keepalive" watchdog for a custom HTTP server: | | keepalive.sh | init.sh |_ main.py There are three files. The first one being ...
1
vote
2answers
163 views

How to run Bash Script in background [duplicate]

I am remotely connected to a system using ssh and want to run nmap on a system from there. But every 5 minutes, my SSH connection breaks and so the process running on my shell stops. How can I run ...
0
votes
1answer
34 views

How to convert my For loop into sequential execution

I wrote the following for loop (spread over multiple lines here for better readability): for F in CLEAN_READS/*_1.fa; do R=${F%_*}_2.fa; BASE=${F##*/}; SAMPLE=${BASE%_*}; metascript assembly -1 ...
2
votes
0answers
60 views

why terminal get closed when putting a wrong command to background in linux

By mistake I executed the following command in Linux abc & it suddenly exits my terminal. Then I tried to put a call to a non-existing command in the background, and the same result happens ...
0
votes
1answer
65 views

How to kill a subprocess shortly after called from parent programmatically?

How can I terminate a process that is launched from within an application programmatically? To clarify, there is an application that launches a WebKit subprocess from time to time, and I want to kill ...
3
votes
2answers
109 views

Can the shell automatically tell me when a background process is complete?

I am just trying to teach myself GNU/Linux-style commands and tools in the bash terminal on my Mac. I want the terminal to automatically display when a background process is complete. There is no ...
1
vote
1answer
154 views

How to kill all background jobs in dash?

Simply kill $( jobs -p ) not work in dash. For example in dash: $ sleep 999 & $ kill $(jobs -p) dash: 2: kill: Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or kill -l [...
4
votes
2answers
123 views

how can I run a command from an environment variable and have the internal trailing ampersand work?

I have this small script I call prompt-to-run. prompt_acc='' read -p 'run `'"$1"'` ' -i "$1" -e prompt_acc $prompt_acc It lets me create a script that fills in a command for me, but gives me the ...
1
vote
1answer
77 views

Can you help me understand this bash behavior? Background processes and their attachment to the current process

I stumbled upon this unexpected behavior and I was hoping someone with a better understanding could explain it! I have a function that is called by a script and run as a background process - ...
0
votes
2answers
123 views

Get output redirection part of a running process

Sometimes I run jobs, I lose track of which output files I have redirected the output to. How can I get the full command I ran a job with, including the output redirection part? For example, when I ...
0
votes
2answers
92 views

`wait` for processes started in a for loop, but not others started earlier

Suppose I have several running background tasks, but now I want to run two more background tasks, but wait only for the last two. For example: # long running commands sleep 60 & sleep 60 & # ...
0
votes
2answers
143 views

Clear up some memory by removing processes shown by Top

I have an old user (bob) in my system. As per output of 'top' it seems that many processes are run by this user (command for most of them is'java'). As I have root access I deleted the user however ...
0
votes
1answer
84 views

Start multiple Firefox tabs (with 5 seconds interval) Minimized From Bash script

I want to open several tabs from a particular domain each with different assets as defined in a bash script. To avoid getting banned from the server, I open tabs with an interval of 5 seconds as ...
1
vote
1answer
148 views

Execute command more than once in the background (bash script)

I am writing a bash script in which I must execute 3 commands. Command 1 must run every 10 seconds, in the background Commands 2 and 3 must run once and also in the background. Also, command 1 must ...
0
votes
0answers
69 views

Terminate a subshell background process

I am starting entr as a subshelled background process as described in its man page to listen to changes to some file foo, occuring during interactive use of some program baz, and I would like to ...
0
votes
1answer
39 views

jobname or alias for background job

Is there any way to put names or aliases for identification in jobs? I tried a clumsy > sleep 10 & # this job sleeps 10 seconds but jobs returns [1] + running sleep 10 And I couldn't ...
8
votes
2answers
559 views

Bash: Multiple for loops in Background

Is this the correct way to start multiple sequential processings in the background? for i in {1..10}; do for j in {1..10}; do run_command $i $j; done & done; All j should be ...
1
vote
1answer
1k views

Run background command from bash script as autostart for i3wm

I'm configuring my i3 window manager (version 4) and sometimes I think the auto-start using its native exec or exec_all fail. (*) So I decided to create a i3_autostart.sh script to add all the stuff ...
3
votes
2answers
658 views

Bash wait for all subprocesses of script

I have a script with for i in 1 2 3 4; do do_something $i & done And when I call it, it terminates before all do_something terminated. I found this question with many different answers. ...
2
votes
1answer
96 views

Bash: when is a PID exactly freed up?

Disclaimer: This question came up much longer than expected. I split it in 5 sub-questions. I really tried to clarify my mind before opening it, but too many aspects are confusing me at the moment. ...
0
votes
2answers
64 views

Why does this bash script terminate the calling process when it ends?

When this bash script is run backgrounded, it terminates the calling shell. Why is this? #!/bin/bash # # weird job control, background termination of parent shell problem set -eum echo "Do not go ...
0
votes
3answers
413 views

Proper way to start a background process

I am just trying to start up a basic node.js server on a remote machine in a ssh session. This seems to work: nohup node server/server.js & disown Maybe I don't need nohup? what's the "official"...
1
vote
1answer
626 views

Opening interactive python shell after running python script in background

python3 -i test.py opens an interactive python shell after running test.py. However, if I try to run it in the background with python3 -i test.py & the job stops automatically with a ^C and shows ...
1
vote
1answer
97 views

Piped command hangs on killed sleeping child

I use a 'watchdog' function to perform a failsafe wakeup if a certain command hangs. This is implemented by running a background task that sleeps for 30s and then executes the wakeup. If the parent ...
3
votes
2answers
188 views

Run script with user input and then disconnect job and run in background

So I have a bash script that first asks for a series of three variables from the user. I then want the script to run in the background disconnected from my session, so that when I cut the connection ...

1
2 3 4 5
11