Questions tagged [jobs]

Job control in a shell

Filter by
Sorted by
Tagged with
0
votes
1answer
24 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
64 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
46 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 ...
2
votes
0answers
32 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
24 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
24 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
65 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
40 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
227 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
0answers
112 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 ...
0
votes
0answers
84 views

.nfsXXX files after using vim [duplicate]

I was trying to use vim on my university server trought SSH connection.. I created file, but i forgot to save it(I accideltaly paused the job with Ctrl+Z).. When I tried to delete the file it showed ...
9
votes
1answer
642 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 '...
0
votes
1answer
74 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
328 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
3k 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
834 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 ...
0
votes
0answers
14 views

Job control and what counts as a single job

I've been learning bash job control (e.g. here, here), but a simple example I made has confounded me: rm tmp for i in {1..30}; do echo $i | tee -a tmp #display counter and write it to log tmp ...
1
vote
0answers
22 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
65 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
284 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
43 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
608 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
128 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)?
12
votes
5answers
3k 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
31 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
25 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
107 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
63 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
77 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
399 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
78 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
2k 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
417 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
238 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
109 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
409 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
1k 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 $...
0
votes
1answer
148 views

How many CPU do I have and how many jobs should I submit?

I do some scientific calculation on a PC(in fact several PCs) and I want to know how many jobs should I submit one time. lscpu shows: CPU(s): 8 On-line CPU(s) list: 0-7 Thread(s) per ...
1
vote
0answers
128 views

In Linux, is there a way to keep the output of the jobs command showing for a set amount of time ?

I have some trouble when running the following jobs command, because it only shows jobs that have been completed (marked with "Done" ) for a brief amount of time. The following screenshot ...
2
votes
0answers
96 views

determining number of free threads

Suppose that on a computer capable of processing n simultaneous threads, one wishes to launch n-m single-thread jobs where m is the number of threads currently in use. How is m defined and by what ...
0
votes
1answer
978 views

Background processes

I have a script that needs to be run on background, if I run the same script on foreground, the script runs good and it wont stop until we manually interrupt (ctrl^c). I am sure that the below ...
1
vote
1answer
1k views

scheduling cron jobs to stop a service on Thursday and start it on Friday

I am pretty new to unix systems and their workings. Is there any way to schedule a cron job in unix which runs on every day 12:00 AM and checks if the day is Thursday it stops a service and if the day ...
3
votes
2answers
968 views

Prevent a shell fork from living longer than its initiator?

If I have a Bash script like: function repeat { while :; do echo repeating; sleep 1 done } repeat & echo running once running once is printed once but repeat's fork lives forever,...
4
votes
2answers
1k views

Is it possible to use commands like `fg` in a shell-script?

I am trying to create a fun Terminal Screensaver which consists of the cmatrix package (one that turns terminal in one similar to the movie The Matrix) and xprintidle to determine idle time of the ...
0
votes
2answers
412 views

stop scheduled cron jobs while database is creating

we have a multi cron jobs runing everyday on different hours. In sometime script is running too long and block database in time where we set up a new one. The problem is that, a new database is no ...
1
vote
1answer
457 views

bash function that sends email after job is finished

I have written following function in my bashrc. It checks if a job is running every 5 seconds and sends email when job is finished. function jobcheck () { time=`date` jobstatus=`jobs $1` while [...
1
vote
2answers
2k views

Foreground and Background

I just wanted to make sure that I understand the foreground and background process. Let's say, I have a program Hello_world. If I want to start the program I type in the foreground: Hello_world ...
3
votes
2answers
1k views

How to put a job in background without output? [duplicate]

When putting a job in background with the command bg, I have the output of the command of the job. How to put the job in background (like the bg command) but without any output? PS: the job is ...