Job control in a shell

learn more… | top users | synonyms

56
votes
6answers
184k views

How to stop a background process?

I have started a wget on remote machine in background using &. Suddenly it stops downloading. I want to stop its process, then start it again. How can I stop it? I haven't close its shell window. ...
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 ...
2
votes
0answers
172 views

Configure job to expire

I'm learning Linux at the moment and were doing some exercises scheduling jobs with cron and crontab, but I'm wondering if it's possible to limit the amount of times that the scheduled job is ran. ...
0
votes
3answers
85 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 ...
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 ...
5
votes
1answer
57 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]+...
7
votes
2answers
552 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 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
34 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?...
-2
votes
5answers
63 views

How to find PID of an ongoing job in UNIX?

I executed a shell script which will call some internal applications and will take few hours. Due to some problems, I have to stop or kill that job. For this, first of all, I ran ps -u $uname to list ...
-1
votes
1answer
68 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 ...
105
votes
4answers
100k views

How to get the pid of the last executed command in shell script?

I want to have a shell script like this: my-app & echo $my-app-pid But I do not know how the get the pid of the just executed command. I know I can just use the jobs -p my-app command to grep ...
3
votes
0answers
51 views

Job queueing on a single machine

I have a shiny new server for running simulations on, with a pair of Tesla GPUs and 32 cores, running CentOS 7.2. I'd like for multiple users to be able to submit jobs to the server that get queued up ...
1
vote
1answer
114 views

Kill a running shell script, and kill all process running within it

I have a shell script running in the background, which runs 5 different jobs. When I run the shell script all 5 jobs start running in order. When I kill this shell, whichever process is running, will ...
4
votes
1answer
95 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 ...
6
votes
1answer
134 views

Is it possible to add a process to the job list in bash (e.g. to reverse “disown”)?

If I disown a job in bash and change my mind, can I undo it somehow ? If so, taking it further, is it possible to bring an arbitrary process under job control (an acceptable restriction would be that ...
0
votes
1answer
33 views

Get PID of scheduled job (using at)?

Say I want to schdule this job to be run at later time MYPROGRAM > output.out 2> error.err | at 02:00 PM Mon How can I attain its PID? surly using: echo $! will not work?
2
votes
2answers
164 views

Is it necessary to disown a process for it to continue running after disconnecting?

Would someone be kind enough to explain if & why disown is necessary if you wish to keep a job running even after you disconnect. I ask because every site I have visited says to use disown and bg ...
0
votes
1answer
35 views

Cannot disown mplayer?

mplayer -vo null -ao alsa test.mp3 & disown It returns sh: 1 : disown: not find Why it doesn't work?
0
votes
1answer
73 views

Schedule a job to run in the background ( one time task scheduling using at )

Is it possible to request for a job to be run at a later specifed time in the background? This is what I have so far, nohup nice MY_PROGRAM > foo.out 2> foo.err < /dev/null | at 05:23 PM ...
17
votes
4answers
11k views

Remove all `at` jobs

I know that to remove a scheduled at job I have to use atrm "numjob1 numjob2", but is there an easy way to do that for all the jobs?
1
vote
1answer
23 views

jobs / wc: getting wierd return values

I can't make sense of these return values. When I run jobs -s | wc -l, I get different results depending on what directory I'm in. If I'm in the directory that I returned to after suspending the job,...
3
votes
1answer
122 views

Shell function to check if there is a suspended process that's a child of this shell?

I'd like to add an indicator to my PS1, showing whether there is a process suspended with ctrl+z. In order to do so, I'll need a function that is able to check for this situation. I'm not even sure ...
5
votes
2answers
263 views

How to launch gedit from terminal and detach it (just like “subl” command works)?

To open a file to edit in gedit I run gedit sample.py &. But with Sublime Text it is simply subl sample.py. This opens the file to edit and it doesn't run in the background (in my shell). How ...
0
votes
0answers
33 views

Will reinstalling cluster OS help running the jobs from being in queue?

I have a problem submitting my jobs to a cluster. I can upload and download files to and from cluster that I am working with but the cluster is unable to run the jobs submitted to them. As I check the ...
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 ...
2
votes
1answer
145 views

zsh wait for jobs to complete

When I type the following in my terminal running zsh (each line is a command) babel www/scripts6/lib/data.js > www/scripts/lib/data.js & babel www/scripts6/lib/user.js > www/scripts/lib/...
0
votes
0answers
41 views

submitting a job array script on SGE

I am trying to make a job array script to do a particular task for several files. Let's assume as a start for only 2 fastq files. Name : abc.fastq , def.fastq #!/bin/bash file=$(ls -1 *.fastq | ...
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 ...
0
votes
2answers
142 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
3answers
549 views

Do I need a computer science degree to have a successful career in Linux? [closed]

I recently got a bachelor's in hospitality management, for 4 years I basically lied to myself thinking thats what I want to study while neglecting my interest in computer science. I've been getting to ...
0
votes
1answer
91 views

How to use jobs command and view results

I am using Ubuntu 14.04 and I am trying to view the list of running jobs using the jobs command yet there is no results shown and when I enter "man jobs" the shell responds that there is no such ...
1
vote
1answer
473 views

Disowned “Stopped” job process still appears in process table

I want to know why after disowning the stopped process, it is still appearing the process table PING www.google.com (74.125.130.106) 56(84) bytes of data. 64 bytes from 74.125.130.106: icmp_seq=1 ttl=...
1
vote
0answers
43 views

How to view document name of a print job

How do I view the document name of a print job? The closest I've come to the answer is with this command... lpstat -W completed ...which displays several results with a timestamp, but no ...
1
vote
0answers
23 views

How do processes, jobs and session relate to each other ? [duplicate]

Could you deliver an answer in a way that does not require too much special knowledge in advance, yet also deliver some deeper insight to a lesser advanced Linux User ?
0
votes
1answer
205 views

How to tell the memory usage of each background job

I am working on SGE, and I am logged on to it. I use qlogin -l mf=30G so as to get onto one compute node. I am running 2 jobs on this compute node in the background. [1] 4408 Running ...
4
votes
1answer
177 views

Why does 'jobs' always return a line for finished processes when run in a subshell within a script?

Normally, when a job is launched in the background, jobs will report that it is finished the first time it is run after the job's completion, and nothing for subsequent executions: $ ping -c 4 ...
2
votes
1answer
47 views

Is there a way to suspend an process belongs to shell A and foreground it in shell B?

I knew how to suspend one process and bring it into foreground in current shell, but I have no idea about that If I have run a process in shell A and now I want to bring it into foreground in current ...
0
votes
2answers
311 views

How to execute unix “jobs” command in python environment

I want to know currently running background process by using unix "jobs" command in python environment. I tried using import os os.system('jobs') but it not works for me
0
votes
1answer
46 views

unable to remove stopped job with ctrl+c

When I tried to change from super user to common user and therefore typed "exit", I got an error message, that a job was stopped and I could not log out as root. So I listed the jobs: #jobs [1]+ yes ...
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 > ...
16
votes
4answers
9k views

Why do some commands 'hang' the terminal until they've finished?

Sometimes you run a program from the terminal, say, lxpanel†. The terminal won't drop you back to the prompt, it'll hang. You can press Ctrl+C to get back to the prompt, but that will kill ...
2
votes
2answers
64 views

Modify background jobs and/or notify on job completion post-launch [duplicate]

I would like to be able to somehow modify a running command and/or get notified when a running command completes after it has been started. Normally, when I know a command is going to take a long ...
2
votes
0answers
260 views

Supervisord scheduling

Is it possible to set jobs to run every n days in supervisord, like what cron is doing? I'm asking because I have different kinds of jobs, continuous / real-time and daily ones. All my jobs are ...
1
vote
1answer
98 views

why jobs doesn't list commands from script

I have a script that runs some programs in the background, but after running it, they are not listed by the command 'jobs'. Why is this? (./m_prog -t m_prog1 m_config) & (./m_prog -t m_prog2 ...
0
votes
3answers
3k views

What is background and Foreground processes in Jobs

I'm studying Redhat Linux 7, topic Monitoring and managing Linux processes in it I understand Processess and its command. But I do not understand "Controlling Jobs" and Running jobs in the background ...
-4
votes
1answer
81 views

What is “jobs” commmand in Redhat Linux [closed]

What is jobs command in Linux and how to use it? Please give some example.
2
votes
1answer
637 views

Bash update list of running jobs with ps

I need to run in parallel a set of computationally intensive tasks. What I was trying to do is to maintain a list of pids corresponding to the running jobs and update the list of running jobs with ps ...
0
votes
1answer
270 views

command “jobs” cannot see the stopped jobs

I have wrote a very simple shell script to practice command "bg" , "fg" and "jobs": #!/bin/bash myvar=1 while [ $myvar -le 100000000 ] do echo $myvar myvar=$(( $myvar + 1 )) done I use ...