Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [jobs]

Job control in a shell

1
vote
0answers
20 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
44 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....
1
vote
0answers
29 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
33 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
103 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
34 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
821 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
22 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
18 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
93 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
53 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
33 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
248 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
41 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
75 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
880 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
177 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
90 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
104 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
250 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
724 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
1k 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
84 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
101 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
81 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
821 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
951 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
682 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,...
3
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
340 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
262 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
831 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 ...
0
votes
1answer
446 views

jobID and PID difference and clarification

So in UNIX every job in a job control centre have a jobID and a PID. What is the difference between the two? I'm also confused at what the point of a jobID is. If you have two of the same type of job ...
1
vote
1answer
575 views

How can you move a file as a background job and delete all other files and the directory before waiting for the job to finish?

I downloaded a directory of files, directory.1 containing the files file.1 file.2 file.3 I move file.2 by mv file.2 ../another.directory & My problem is I want to get rid of directory.1 and ...
2
votes
1answer
2k views

How do I wait for background jobs in the background?

I have the following problem: $ some_command & # Adds a new job as a background process $ wait && echo Foo # Blocks until some_command is finished $ wait && echo Foo & # ...
0
votes
3answers
118 views

How to start two processes in the background and bring the second job into the forground?

These two processes: cat /dev/tty > /dev/null & cat /dev/zero > /dev/null & have to run in the background but i am having trouble bringing the second job to the foreground.
-3
votes
1answer
348 views

How to run a command in the background?

How would you run man -df in the background properly? When I try ping man -df > /dev/null it goes through at first it gives me a PID number but then it says ping unknown host man and it doesn't list ...
8
votes
2answers
5k views

What happens to background jobs after exiting the shell?

From my understanding, jobs are pipelines (http://web.mit.edu/gnu/doc/html/features_5.html) started from a certain shell and you can manage these jobs (fg, bg, ctrl-z) from within this shell. A job ...
3
votes
2answers
334 views

Pipe all the suspended processes to kill

I am running a script which has to be suspended before killing. The first time I run it there is only one pid for the process. I kill it and run again and the number of PID goes increasing. First of ...
2
votes
0answers
45 views

Better way to go to background in a running command [duplicate]

Actually I do this to bring a running command from the foreground into the background: ctrl+z and then bg There is a better way? Because ctrl+z just pause the process and after that I need to run ...
0
votes
1answer
198 views

Cron job for 7 days alone not followed by multiple weeks

I need to execute a cronjob to run once for 7 days alone. I have tried like this: 0 0 * * 0-6 myscript.sh It gets run for once a day and running every day of the week since I gave as 0-6. But I ...
30
votes
4answers
3k views

What is the purpose of delayed suspend (Ctrl-Y) in Bash?

The full portion of the Bash man page which is applicable only says: If the operating system on which bash is running supports job control, bash contains facilities to use it. Typing the ...
3
votes
1answer
1k views

backgrounded job keeps stopping

I am seeing some strange behavior on my RHEL6 bash prompt. I often like to execute command lines that look like ... $ ./myscript > junk 2>&1 ... then hit ^Z and then execute ... $ bg $ ...
3
votes
2answers
2k views

Why does the jobs command not work in shell script?

If I run jobs -l on command prompt it shows me the status of running jobs but if I run below file ./tmp.sh #! /bin/bash jobs -l It shows empty output. Why is that and how can I obtain information ...
6
votes
1answer
424 views

Cannot grep jobs list when jobs called in a function

I can grep the output of jobs, and I can grep the output of a function. But why can't I grep the output of jobs when it's in a function? $ # yes, i can grep jobs $ jobs [1]+ Running vim [2]+...
2
votes
2answers
5k views

how to kill job in background?

I know how to kill a job with kill %(number) but is it possible to kill a job as background job, the question is "kill tail as a background job?"
3
votes
2answers
1k views

Is there a limit to processes I can run in the background?

Is there a limit to how many jobs you can have running in the background when using command prompt? I've heard varying answers to this question, but is there a concrete number that is set as the limit?...
4
votes
3answers
2k views

process command and the percent sign usage

I am confused about stopping a job by using the percent sign with the kill command. I cannot find any documentation in the man pages for kill that indicate the percent sign can be used. Can someone ...
-1
votes
1answer
819 views

Is there a way of getting full name of background jobs/ processes?

jobs -l This lists the jobs, but my job names are long and identical and this leads to a confusion as to which one them completed. Eg: if my jobs are: aaaaaabbbbbbccccc...............123 ...