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

learn more… | top users | synonyms

2
votes
1answer
31 views

Clarification for Bash documentation on disown builtin option -h

According to the documentation: To prevent the shell from sending the SIGHUP signal to a particular job, it should be removed from the jobs table with the disown builtin or marked to not ...
1
vote
0answers
31 views

Any caveats to using bash disown from a shell script as an alternative to screen?

I have a process which starts and outputs to a log file. The script which starts it launches it in a GNU screen and then follows the log with tail. The process will immediately begin writing to the ...
1
vote
1answer
34 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 ...
3
votes
2answers
56 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
25 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 ...
0
votes
1answer
32 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
21 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 ...
-1
votes
1answer
29 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?
4
votes
1answer
107 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 ...
7
votes
2answers
560 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
vote
2answers
58 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
169 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
57 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
2answers
170 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, ...
2
votes
3answers
176 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
158 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
402 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
139 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
232 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@...
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 ...
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 ...
4
votes
1answer
627 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
149 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
69 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 ...
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 > ...
5
votes
4answers
3k 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
242 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
43 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-...
2
votes
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
607 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 ...
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 ...
0
votes
2answers
427 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
574 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 ...
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 ...
0
votes
1answer
30 views

Starting up and keeping up a process

I am having an Ubuntu box on which I am having a Haskell process (think of it as a random server process) that I built. I want to start it on boot and restart it in case it fails for whatever reason (...
0
votes
1answer
104 views

How to dynamically chose PBS queue during job submission

I run a lot of small computing jobs in remote cluster where job submission is managed by PBS. Normally in a PBS (bash) script I specify the queue that I would like to submit the job through the ...
1
vote
1answer
233 views

Submitting jobs with sequential completion

If I have numerous jobs that rely on environment variables, how can I submit them sequentially? Here is my attempt that has not been working, week 6 is always submitted (and finishes) before week 5. ...
0
votes
2answers
330 views

UNIX: Submit job only after previous job completes?

I would like to submit the same .sas job iterating over an argument, but I would like job only to be submitted after the previous is completed. Here is my attempt: #!/bin/ksh export weeks="1 ...
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 ...
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
2answers
943 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 ...
4
votes
5answers
5k views

Run a process to particular/dedicated pid only

I have a c program executable or shell script which I want to run very often. If I want to stop/pause or to notify something I will send signal to that process. So every time I have to check the pid ...
1
vote
0answers
144 views

Why doesn't putting elinks in background and then resuming with `fg` work reliably?

The elinks program takes over the terminal to let you browse the web. But its behavior in the context of job control is wonky. If I CTRL-Z suspend an elinks session, and then try to resume it with ...
0
votes
1answer
173 views

When executing a command, it is automatically suspended

The problem happened on one of my local machines with CentOS 6. I ssh to it from my MacBook trying to test a script, which is in /usr/local/bin. However, whenever I tried to execute the command, it is ...
1
vote
3answers
33k 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 ...
0
votes
1answer
147 views

Stop tailing log

I have a problem, I accidentally did tail -f on a log, but now I cant quit! - Its the anaconda log during a redhat install. Control-C doesn't seem to work, I guess due to it saying sh: no job control ...
1
vote
1answer
375 views

fg a bg process because you forgot to redirect output to /dev/null

I did Ctrl+Z bg with the intention of disowning next, but I forgot to redirect, now I cant get to my terminal because the scrolling of the output (tarballed a huge directory with verbose set). How do ...