Questions about the various ways jobs can be controlled by the shell: suspending, resuming, terminating execution etc.

learn more… | top users | synonyms

0
votes
1answer
30 views

Can't terminate / suspend a background job

I am a beginner so I wanted to do a test for the Job Control Commands. So, I ran a cat command and then made it a background job using the bgcommand after stopping it with Ctrl +Z. Now I wanted ...
8
votes
2answers
1k views

Can someone explain in detail what “set -m” does?

On the man page, it just says: -m Job control is enabled. But what does this actually mean? I came across this command in a SO question, I have the same problem as OP, which is "fabric cannot ...
1
vote
2answers
1k views

Basic job control: stop a job, add a job onto the stack, and `fg`

Job control is probably my favorite thing about Linux. I find myself, often, starting a computationally demanding process that basically renders a computer unusable for up to days at a time, and being ...
3
votes
2answers
53 views

Job control in dash

I don't understand the problem about which the standard shell in Debian (dash) complains: test@debian:~$ sh $ man ls ctrl+Z [1] + Stopped man ls $ jobs [1] + Stopped ...
1
vote
1answer
24 views

Job scheduler with task instance count [closed]

For a website I'm developing I need more control over scheduled jobs then cron. Instead of building something it would be nice to use existing software. The most important requirement is that it is ...
72
votes
4answers
126k views

How to suspend and bring a background process to foreground

I have a process originally running in the foreground. I suspended by Ctrl+Z, and then resume its running in the background by bg <jobid>. I wonder how to suspend a process running in the ...
0
votes
1answer
24 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 ...
27
votes
3answers
1k views

Do programs run from an ssh session depend on the connection?

Does a program that is run from an ssh session depend on the connection to the client? For example when the connection is really slow. So does it actively wait until things are printed on the screen? ...
0
votes
0answers
20 views

Checking the status of submitted job

I submitted a job using: qsub ROSE_main.sh #inside the .sh file : #! /bin/csh #PBS -l mem=20gb #PBS -l ncpus=20 #PBS -l walltime=900:00:00 #PBS -l cput=900:00:00 #PBS -e ~/Tool/rose/qsub_error.txt ...
50
votes
2answers
43k views

How to suspend and resume processes

In the bash terminal I can hit Control+Z to suspend any running process... then I can type fg to resume the process. Is it possible to suspend a process if I only have it's PID? And if so, what ...
28
votes
3answers
14k views
7
votes
2answers
553 views

Ctrl-C kills whole line while Ctrl-Z doesn't

I am running multiple commands on the command line separated using semi-colons: cmd1; cmd2; cmd3 If I press Ctrl+C on the above, it would kill all commands instead of just the one which is executing ...
-1
votes
1answer
28 views

Does jobs list only background and stopped jobs? [duplicate]

When jobs is run in a shell, does it mean that all other jobs must be either background or stopped? Is there no foreground jobs? Does jobs list only background and stopped jobs?
22
votes
6answers
15k views

How can I close a terminal without killing its children (without running `screen` first)?

sometimes I run an app in the gnome-terminal, but then I suddenly have to restart gnome or something. I guess the answer to the question is also useful then I want to disconnect from SSH where ...
262
votes
2answers
76k views

Difference between nohup, disown and &

What is the difference between $ nohup foo and $ foo & and $ foo & $ disown
17
votes
5answers
12k views

How can I kill and wait for background processes to finish in a shell script when I Ctrl+C it?

I'm trying to set up a shell script so that it runs background processes, and when I Ctrlc the shell script, it kills the children, then exits. The best that I've managed to come up with is this. It ...
3
votes
4answers
712 views

How can I turn the behavior of `gedit something & disown` into the default behavior when calling gedit from the command line?

When I gedit files from the command line, it's always locking the terminal, and I'm tired of explicitly commanding a detached process for it. I tried to alias gedit as something like gedit $* & ...
4
votes
1answer
98 views

Why is subshell created by background control operator (&) not displayed under pstree

I understand that when I run exit it terminates my current shell because exit command run in the same shell. I also understand that when I run exit & then original shell will not terminate because ...
8
votes
1answer
12k views

How to recover a backgrounded job from a previous shell? [duplicate]

Possible Duplicate: How can I disown a running process and associate it to a new screen shell? I launched a command that lasts a long time. I had to disconnect so I moved it in the background (...
6
votes
1answer
2k views

Change the parent process of a process?

Is it possible to change the parent process of a process? If yes, how? For example, how does screen manage to attach a screen session and the processes running inside it to different shell ...
20
votes
4answers
6k views

What happens to the output of a process that has been disowned and lost its terminal?

If I close the virtual terminal, where some process was started, does the output just go straight to /dev/null, or can it pollute memory somehow? Can I anyhow grab the output to continue reading it at ...
113
votes
8answers
61k views

How can I disown a running process and associate it to a new screen shell?

I have a running program on a SSH shell. I want to pause it and be able to unpause its execution when I come back. One way I thought of doing that was to transfer its ownership to a screen shell, ...
8
votes
4answers
1k views

Get PID of any command in backgrounded piped sequence of commands

If, in bash, I execute: cmd1 | cmd2 | ... | cmdi | ... | cmdn & where the cmd{1..n} may not be distinct, how do I get the PID of cmdi? Alternatively, how can I signal the cmdi process? (For ...
1
vote
2answers
55 views

How to control a backgrounded subshell?

If I run the following command at a bash prompt: (for i in {1..100}; do echo $i; sleep 1; done) & It will start counting and immediately return me to my prompt. I can continue working normally, ...
1
vote
2answers
167 views

Result of combination of Ctrl+c and then Ctrl+z in shell

Which signal will be sent to the running process after sending the Ctrlc after 500ms of Ctrlz? I have tried to give the Ctrlc after Ctrlz but I didn't get the exact answers for this.
0
votes
2answers
50 views

How to resume a program when logged in with different session

Here is the scenario: Let's say that I log into my server via ssh and start an emacs or vi (or whatever other program) session. Then my ssh connection disconnects. Is there a way for me to reconnect ...
1
vote
3answers
31k views

How to get the Job ID? [duplicate]

As we know, the shell enables the user to run background processes using & at the command line's end. Each background process is identified by a job ID and, of course, by it's PID. When I'm ...
1
vote
2answers
155 views

Job control over a Bash script

I have a Bash script of a thousand lines each containing an ffmpeg command. I start this with source script and it runs just fine. However, when I try to take control of this script in various ways, ...
8
votes
1answer
16k views

ctrl c vs. ctrl z with foreground job

Ctrl+Z stops the job whereas Ctrl+C kills the job. Why is that? Wouldn't the other way make more sense? z@z-lap:~$ sleep 100& [1] 4458 z@z-lap:~$ sleep 200& [2] 4459 z@z-lap:~$ jobs [1]- ...
2
votes
3answers
165 views

Preventing terminal disconnection from killing a running job in zsh [duplicate]

I went through the top answer to this question: Difference between nohup, disown and &, and I read specfically the following: With disown the job is still connected to the terminal, so if the ...
0
votes
2answers
145 views

Live monitoring of background jobs

I executed a command like this: nohup some_command &. Now this command is in the background. I can see it with the command jobs. Example output: [1]+ Running nohup some_command &...
2
votes
2answers
919 views

Queue a task in a running shell

I often start a long running command that is bound to either CPU, Disk, RAM or Internet connection. While that is running, I find that I want to run a similar command. Let's say downloading something ...
2
votes
2answers
322 views

How do I kill a process after detaching it from bash?

I have multiple scripts that detach a process from bash using nohup and &>/dev/null &. My question is, how do I kill the process after completely detaching it from bash. using killall or ...
7
votes
4answers
1k views

Why doesn't SIGKILL terminate a stopped program (yes)?

I'm using Ubuntu 14.04 and I'm experiencing this behavior I can't seem to understand: Run the yes command (in the default shell: Bash) Type CtrlZ to stop yes Run jobs. Output: [1]+ Stopped yes ...
2
votes
1answer
136 views

Force a job to come in foreground when asked for user input

I'm currently working on an audit-script for a huge platform. In the main-script we use traps and in one of the traps I ask the user for clean up the files. The script has no output in standard output,...
2
votes
2answers
221 views

Linux stop background process via kill + PID

Here http://unix.stackexchange.com/a/104825/109539 man says that to stop background process kill + PID must be used. However I can't stop background process using kill +PID, only kill + JOB ID [KPE@...
2
votes
1answer
1k views

redirecting output of running background job in bash

in bash I have some jobs running, in background. They are always producing random irrelevant error messages that pollute the terminal. I am not always so prompt to start them with the 2>&1 > ...
3
votes
1answer
563 views

Minus and Plus Sign in jobs Process

These commands are running in the background: foo@contoso ~ $ sleep 30 & foo@contoso ~ $ sleep 60 & foo@contoso ~ $ sleep 90 & What is the minus and plus sign after running jobs process? foo@...
2
votes
0answers
143 views

A way to distinguish between interleaved output from two background processes

If I have two backgrounded processes that produce input to STDOUT or STDERR (e.g., two installation scripts), is there an easy way to make these two output streams distinguishable? I guess I can pipe ...
2
votes
1answer
68 views

Pipelines, Jobs and Processes in Zsh

I went through the Jobs & Signals documentation in Zsh, but some things aren't still clear to me. It says: If the MONITOR option is set, an interactive shell associates a job with each ...
5
votes
4answers
2k views

When I run `./command.sh &` the background task is suspended. How can I keep it running?

This is what I'm running: alexandma@ALEXANDMA-1-MBP ./command.sh & [2] 30374 alexandma@ALEXANDMA-1-MBP [2] + suspended (tty output) ./command.sh I don't want it suspended to start, I want it ...
2
votes
3answers
233 views

Running a timed background job in bash

I would like to execute a command in bash every 30 seconds and have it run as a background job. Form this post, I gather that using the watch command is useful. However every time I attempt to ...
1
vote
1answer
42 views

Replacement queue now that batch doesn't accept input files?

Background I work at a research institute, and have for a long time used the batch command to submit job queues to our machines. However, a recent update changed the batch command to be POSIX-...
1
vote
1answer
5k views

Start a background process from a script and manage it when the script ends

I'd like to run and configure a process similarly to a daemon from a script. My shell is zsh emulated under Cygwin and the daemon is SFK, a basic FTP server. For what matters here, the script ...
1
vote
1answer
590 views

Running commands after ampersand symbol & in a remote ssh session

I have a shell script that initiates a long, resource-intensive command on several different machines. In order to execute the script on each machine in parallel, I have an ampersand symbol after ...
1
vote
1answer
43 views

Run program while computer is cool

I'm trying to compile a program on a computer with inadequate cooling. The program, specifically, is the linux-ck kernel with -mtune=native march=native processor-specific optimizations, so simply ...
0
votes
2answers
408 views

How to know when a job in screen finishes?

Is it possible to know if a script executed inside a screen session finished or not? The script can be seen by typing jobs and I would like to terminate the screen session when the script is finished. ...
3
votes
2answers
559 views

What would stop a task from being run in the background?

I have a script I'm trying to launch with php ./Script.php & The task goes into the background but it is stopped. When I try to run it with bg it simply stays stopped. $ jobs [1]+ Stopped ...
5
votes
4answers
3k views

disabling job control in bash (CTRL-Z)

It happens to me sometimes, that I press CTRL+Z by accident and my application disappears into background. I know, I can bring it back with fg, so it's not such a big deal. But I am wondering about ...
0
votes
0answers
17 views

How to cancel my job [duplicate]

I'm a beginner about LINUX in korea and English is too. I'm circulating some simulation by using the LINUX cluster but I have some problem in my job. I want to cancel any job (ID : 750, 752, 753 ...