suspend a *background* running job


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers suspend a *background* running job
# 1  
Old 12-26-2010
suspend a *background* running job

Is there a way to suspend (TSTP?) a job that is running in the background, _without_ first bringing it to the foreground and inputting Ctrl-Z from the keyboard?

IOW, something similar to issuing the shell's bg builtin command on a job ID to resume a job that is suspended in the background, except here we want to _suspend_ a job that is already running in the background.

Cheers
# 2  
Old 12-26-2010
I don't know of a shell builtin for that, but you can suspend it with kill -STOP pid and resume it with kill -CONT pid
# 3  
Old 12-26-2010
Thanks.

This works great. But the new status is not immediately reflected in the jobs -l output.

Can I get the status to update with another signal?

Certain events seem to trigger an update in the status, e.g., bg'ing another job, or a pipe.

Considering a pipe triggers the status update, this is the lame hack I came up with show the updated status immediately:

Code:
lamehack(){ kill -18 %$1; :|: ;}


Last edited by uiop44; 12-26-2010 at 11:11 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Get status of dd running in background job

Hello everyone While working on TUI for scripts, there there came the idea to' add a command' for dd too. That was, after 'wrapping' tar and wget either, to display their growing size and return the exit code with a textual-visual-feedback to the user. Now displaying the filesize of a... (13 Replies)
Discussion started by: sea
13 Replies

2. Shell Programming and Scripting

Execute a function in background and then suspend it

Here is some back ground on the script. The script is to poll an arbitrary number of DB's. To do this I am creating a function that takes the file_path to the DB and the min poll interval as arguments. The function will be called for each DB and then ran in the background. The function I was... (6 Replies)
Discussion started by: ryandavison
6 Replies

3. Solaris

Is user cron job running in background?

Hi, Should the user jobs specified in crontab be running in background? Cron daemon is already running in background. So I am not sure whether should the jobs (output and error messages are redirected to file) ran by it be explicitly stated to be run in background (& at end of command) if one... (1 Reply)
Discussion started by: joe_x
1 Replies

4. Shell Programming and Scripting

Background Job

Hello Everyody, Having a doubt. sort file1 & when we sent a job to the background it returns Job Number PID again if we want to ... (1 Reply)
Discussion started by: knroy10
1 Replies

5. AIX

Question on background running job

Guys, We use AIX 5.3 at our work place. I only in my team have a strange problem of not able run jobs background. Other colleagues are able to run without any problem. Once I kick off background job using nohup and & command, It immediately stops. The following error I get when I run. ... (2 Replies)
Discussion started by: anandsbr
2 Replies

6. Shell Programming and Scripting

Suspend Cron job temprory

Hi Is there any way to suspend cron job without ommitting crontab entries?? I have a no of entries in crontab, which runs daily.......... what if I want to suspend all process in cron one day . Is there any one line command for it ?? Please suggest Rergards Pankaj (4 Replies)
Discussion started by: pankajkrmishra
4 Replies

7. UNIX for Dummies Questions & Answers

background job

on gnome i open a terminal and run wget http://soommmething & in the background. because wget shows me downloading progress percentage and download speed continuously, I exit the gnome-terminal after a while i want to see the download percentage but dont know how. my ps -u myname shows that... (3 Replies)
Discussion started by: babayeve
3 Replies

8. UNIX for Dummies Questions & Answers

Background job

Hiya, Recently I've run a few scripts in the foreground, but have realised later they should of been better nohup'd and placed in the background. I understand how to change a foreground job into a background one, but how would put the job into the nohup state? Thanks (1 Reply)
Discussion started by: rdbooth
1 Replies

9. UNIX for Dummies Questions & Answers

background job

I try to run a script as background job. script: #!/usr/bin/csh /usr/bin/date +20%y-%m-%d > ~/datsql.txt If I start it I got this output: tac> ./datermitteln& 293 + Stopped (SIGTTOU) ./datermitteln& I insert the following line inside my script, but without any... (3 Replies)
Discussion started by: joerg
3 Replies
Login or Register to Ask a Question