Questions tagged [jobs]

Job control in a shell

Filter by
Sorted by
Tagged with
0
votes
0answers
48 views

Why bash need job control?

Why Unix systems need job control? So for example, we can use the process number or job number(jobspec) with the kill command. $ sleep 101 & [1] 19 $ sleep 102 & [2] 20 $ jobs -l [1]- 19 ...
3
votes
1answer
25 views

Usage example of “x” option of “jobs” command in bash

When i look at the jobs -x explanations, it says: If the -x option is supplied, jobs replaces any jobspec found in command or arguments with the corresponding process group ID, and executes command, ...
0
votes
1answer
29 views

Why is a process being shown while using “jobs” command after killing the process manually?

Why is the parole(just a media palyer) still listed in the "JOBS" command output even after killing maually and why is not listed in the "PS" command output ? Does this mean the ...
1
vote
1answer
28 views

Return to a particular job in the jobs list

If I have the following jobs running in a shell -> % jobs -l [1] 83664 suspended nvim [2] 84330 suspended python [3] 84344 suspended python [4] 84376 suspended nvim [5] - 84701 ...
1
vote
1answer
35 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
1answer
16 views

cron job for ubuntu to solve apache2 ram problem

Sometimes Apache2 keeps generating new processes till the ram is totally consumed and all websites become very very slow. I wrote a bash file and created a cron job that checks ram usage every minute. ...
0
votes
2answers
40 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
0answers
18 views

Cron Job is running outside of defined schedule

I have a question and am relatively new to scheduling Cronjobs in R Studio. I have an R script that I would like to run every Monday - Friday, every 1 minute, and between the hours of 9 - 16 (9 am to ...
0
votes
2answers
56 views

How do you keep this dastardly bash script running in the background 24/7?

This might sound like a duplicate, but hear me out first. I run a shell script, which has a standard input active and sometimes on startup requires some input. I need for it to run 24/7 and it needs ...
1
vote
1answer
51 views

How does bash `auto_resume` job control variable works?

Chapter 7.3 Job Control Variables in Bash Reference Manual has the following description about auto_resume variable: auto_resume This variable controls how the shell interacts with the user ...
1
vote
0answers
51 views

Why `kill %jobnumber` not working on stopped jobs? [duplicate]

I'm running few tasks side by side on an ubuntu 18 LTS. So I'm switching between these jobs by running # command & # fg # fg - (Also) use of Ctrl+z sometimes to send running job to background. ...
0
votes
1answer
33 views

How do I change a value in a line of an existing script to reflect the (numerical) folder name?

I'm running a job where I have multiple folders (labelled 0 to 41), each containing an identical script which need the ninth line edited: #SBATCH -J aXau19 X should correspond to the name of the ...
0
votes
0answers
25 views

jobs command — why different output?

When I run the "jobs" command to track processes I see different output in different bash log-in sessions. I am logging in as the same user but creating new log-in sessions. In the new session, I run ...
0
votes
1answer
67 views

How much storage is this fio command utilizing?

I have a fio workload running as a Job. Fio workload: --- kind: PersistentVolumeClaim apiVersion: v1 metadata: name: fio-target spec: #storageClassName: ocs-storagecluster-cephfs ...
1
vote
1answer
177 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 [...
0
votes
2answers
133 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 ...
1
vote
0answers
56 views

Key binding to swap shell foreground/background jobs

In spite of heavy tmux use and switching between panes, I still frequently find myself using shell job control. When something needs poking I'll background the tool I'm using with Ctrl+Z, poke the ...
0
votes
0answers
46 views

How to kill a process from Cron

Usually I do like this: kill -9 $(ps aux|grep Firefox|awk '{print($2)}') But when I try following via cron, it does nothing. 50 * * * * kill -9 $(ps aux|grep Firefox|awk '{print($2)}') Mind you the ...
0
votes
1answer
45 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 ...
1
vote
1answer
228 views

Editing a job in At command

Trying here to modify a job from at command. Any idea on how to do it? Already managed to list it, delete, and execute, but can't modify it.
0
votes
0answers
43 views

show stdout of background jobs inline

Is there an easy way to make the jobs command display its stdout inline? I am backgrounding long-running jobs with integer outputs. I need to visually compare those outputs, but they are sent without ...
1
vote
1answer
658 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 ...
2
votes
0answers
194 views

Bash: kill process and all subprocesses without using group id

TL;DR, I need a way to kill a process and all descendant processes, without killing siblings with the same group id, without output printed in the terminal, and with a non-zero exit code. I have a ...
9
votes
1answer
674 views

Explain why watch 'jobs' does not work but watch 'ps' work?

jobs is my favorite command to see my codes which are running in the background. In order to check for them dynamically, I tend to type watch 'jobs' which does not display anything. However watch '...
1
vote
1answer
809 views

A stop job is running… if I execute dhcpcd and don't kill it on ARCH

I have recently installed arch. Noticed that when shutting it down often a "A stop job is running for session 3 of root.." message appears which takes 1:30 minutes to dissapear. Further investigation ...
0
votes
1answer
1k views

What is the logic of using $($(nproc) + 1) in make command?

I was trying to install OpenCV in Ubuntu based on few guides online. One of the guides is this one. It has the following line: make -j $(($(nproc) + 1)) The nproc returns the number of processors/ ...
13
votes
4answers
4k views

What happens if I start too many background jobs?

I need to do some work on 700 network devices using an expect script. I can get it done sequentially, but so far the runtime is around 24 hours. This is mostly due to the time it takes to establish a ...
4
votes
4answers
1k views

Command for “wait for the job to finish and then begin another job”? [duplicate]

Without knowing ahead of time that I'll want to do this, is it possible to wait for a job to finish and automatically begin executing another one? For example, I jump into a tmux session and execute ...
1
vote
0answers
24 views

Why does my job control fail inside a loop? [duplicate]

My bash script is supposed to start a process (let's say, run less) and bring it back to foreground every time the process is suspended (e.g. by pressing CTRL-Z). If I just keep repeating the ...
1
vote
1answer
111 views

Does a shell which does not support job control has the concept of foreground and background processes?

I used to think that only if a shell supports job control, can it has the concept of "foreground" and "background" processes (group). But I read a paragraph indicating that's not true. From APUE § 10....
2
votes
0answers
647 views

List all jobs in all shell sessions (not just the current shell), by current user

I know that the jobs command only shows jobs running in current shell session. Is there a bash code that will show jobs across shell sessions (for example, jobs from another terminal tab) for ...
1
vote
1answer
61 views

How to get variables expanded in output of jobs command

As you can see in the following output the variable $i in the output of ps aux is expanded to sleep 1, sleep 2, etc. Is there a way to make zsh do the same? In the jobs output all the commands get the ...
0
votes
1answer
1k views

How to check which process is writting on FileSystem Solaris

I need to identify what process is writing non-stop on the Disk. I tried to run prstat -t to get the list of the processes running, but I can't identify/find which process it is. running df -k , I ...
1
vote
1answer
229 views

Making zsh jobs -p behave as in bash

Is there a way to make jobs -p in zsh behave as in bash, ie. give only a number, such that one can do kill $(jobs -p)?
15
votes
5answers
7k views

How to plan a task to run after another already running task in bash? [duplicate]

I'm looking for something like command1 ; command2 i.e. how to run command2 after command1 but I'd like to plan execution of command2 when command1 is already running. It can be solved by just typing ...
0
votes
1answer
33 views

copy numerous files/folders in linux with queuing and the ability to break and continue

I'm copying terabytes worth of data from an OLD OLD OLD *nix system. I could spend the money to buy new hardware to plug the drives into but I want to avoid spending money. The system is crappy. It ...
0
votes
1answer
30 views

Submitting HPC jobs within an HPC job

I have a large script which relies on input arguments (with getopts). One of these arguments is a directory containing files (all named *bam) This script has 2 parts: Part1: based on input *bam ...
0
votes
1answer
146 views

Asynchronous background jobs in linux can interfere to each other?

I was trying to use a linux command repeatedly and I decided to use bash scripting. The command is curl and it has blue screen given to the target web server. I was doing this as a pentester in my ...
0
votes
1answer
78 views

How can I periodically record the dir stack and jobs of a shell without occupying the shell?

I have a script $ cat my.sh #! /bin/bash - dirs -l > /tmp/test/dirs_record jobs > /tmp/test/jobs_record So when I source ./my.sh, it will output the dir stack and jobs in the invoking shell. ...
2
votes
2answers
138 views

Jobs not appearing in `jobs`

I have a script called go.sh python3 bob.py &> lol.log & python3 alice.py &> lol2.log & When I run ./go.sh and then run jobs. Neither one of the jobs that I've executed in go....
1
vote
1answer
536 views

In bash, a process group is a job if and only if …?

Here are two cases when a process group in an interactive shell isn't a job of the shell: $ sleep 100 & [1] 16081 $ jobs [1]+ Running sleep 100 & $ disown %1 $ jobs $ and $ ...
-3
votes
1answer
51 views

Remove all scheduled before 17:00 jobs with atrm [closed]

I need a shell script that removes all scheduled before 17:00 jobs with the user name as a positional parameter This is what I tried to do #!/bin/bash currentTime = ‘date + %k%M’ check_time_tu_run() {...
0
votes
1answer
81 views

Linux review T background job

user 23110 0.1 1.7 615392 73004 pts/2 T 20:57 0:13 process I have a process what I put in the background on a terminal which froze after. Not responsive for keys/reset/commands etc. I ...
0
votes
1answer
3k views

How can we kill all the background jobs (running or not) in the current shell?

From https://unix.stackexchange.com/a/43709/674 To just kill all background jobs managed by bash, do kill $(jobs -p) Does kill $(jobs -p) kill only those "running" background jobs in the current ...
2
votes
1answer
578 views

Why is ps -u command not working?

When I use the 'top' command I get 10366 mithus 25 0 11120 1044 884 R 99.9 0.0 67:14.35 gm when I start a process using nohup ./gm &. showing that a process 'gm' is running. ...
2
votes
1answer
336 views

How does bash's job control handle stopped or terminated background jobs?

While studying the internals of bash's job control mechanism under Linux I have came across a little problem of understanding. Let's assume the following scenario: script is executed in background ...
1
vote
1answer
112 views

How do I process my data file in bunches (without using the app parallel)? [duplicate]

I have an analysis program and a text file with data in it which for the sake of exposition I will call wibble and data.txt respectively. I tried a simple for loop to process all of my data:for i ...
0
votes
1answer
460 views

How do I submit SAS jobs in batch mode?

I am using SAS, an analytics software package for Unix (amongst others). I am connecting to my Unix system with PuTTY. I want to submit 10 sas programs via putty. My requirement is that each job ...
1
vote
2answers
2k views

Running picocom in the background without open session

I would like picocom to log serial data on a remote computer, without having to keep my ssh session to the remote computer alive. I have tried: picocom <my options> This dies when I logout. ...
6
votes
3answers
2k views

Bash: wait for a fix number of process

I wrote a bash script that executes a Java jar for a n number of times. In practice, I defined e foo() function, containing the invocation of the jar, and then I run this script: for RUN in $(seq 1 $...