Sponsored Content
Top Forums Shell Programming and Scripting Send Foreground job to background redirecting output Post 302402880 by dennis.jacob on Wednesday 10th of March 2010 11:15:24 PM
Old 03-11-2010
Just a small thought...

Assume a process(test.sh) is running with a pid xxx

If we give the SIGSTP signal, say
Code:
kill -17 xxx

, it will signal the process

Code:
[1] + Stopped (SIGSTOP)        sh test.sh

now, why cant we give bg which will change it to running in bg?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

problems with ctrl-z, to switch foreground, background

my shell is /sbin/sh. i added stty susp '^Z' with the intention of being able to switch between foreground and background. but the result was strange. i had 2 servers. one is sun the os is 8 and the other is hpux v11. both of them had the same shell. but on hpux, it works perfectly fine while... (9 Replies)
Discussion started by: yls177
9 Replies

2. UNIX for Dummies Questions & Answers

set background/foreground color in .profile

I am using a telnet session (VT100) and need to modify my .profile so that it will set the color of the telnet session. I am not using Xterm (ie: can't use .Xdefaults). I am able to change the colors via menu's but need to preset in .profile. Is this possible??? Can't find anything at all on how... (3 Replies)
Discussion started by: dvella
3 Replies

3. Shell Programming and Scripting

how to get background job to foreground

hi, i am just wondering that wen we give the following code we make a process run in background...can the viceversa be performed?i.e can this be made foreground again # sleep 75& 21751 # (4 Replies)
Discussion started by: sandilya
4 Replies

4. Shell Programming and Scripting

Background and Foreground of a process within a script

I'm not sure if it is even possible but I figured if it was someone here would know how to do it... I am running a script which starts a bunch of processes in the background but there is one process I would like to bring back to the foreground when complete. Unfortunately the process that I... (2 Replies)
Discussion started by: ctruhn
2 Replies

5. UNIX for Advanced & Expert Users

what is the diff b/w background and foreground process

What are all the difference between a Background and Foreground processes ?! A Background process does not have access to STDIN and OUT.. What else ? Is there any detailed description available somewhere ? (5 Replies)
Discussion started by: onequestion
5 Replies

6. Shell Programming and Scripting

How can put a background process to the foreground

Hi, guys: I am working on my own shell using c. When I put a process into the background, how can I put it back to the foreground using tcsetpgrp? Thanks (3 Replies)
Discussion started by: tomlee
3 Replies

7. Shell Programming and Scripting

Move shell script from foreground to background

Hi, Need an urgent help. I have a program executing in foreground. I need to execute it in background and also to remove terminal dependency. Thanks In advance. 116@434 (7 Replies)
Discussion started by: 116@434
7 Replies

8. Shell Programming and Scripting

Capturing the output of a background job

Hello, I unfortunately have a process that does two things, it returns an answer to me and then does a bunch of work that I would like to wait on. Here is a simple example: #!/bin/bash function p_w { echo "poopy" sleep 10 echo "scoop" } foo=$(p_w &) sleep 1 echo "1... (7 Replies)
Discussion started by: brsett
7 Replies

9. UNIX for Dummies Questions & Answers

Send job to Background after input redirection

Hi, I am having issues with syntax when I am trying to send a job to the background after a input redirection. I have this script which sends some files to different servers after zipping them. Once I execute it, it will ask for user input as of which server the files need to go to. (The... (3 Replies)
Discussion started by: grep_me
3 Replies

10. UNIX for Dummies Questions & Answers

How do I send output of a background process to a file other than nohup.out?

I have a question. I will be running a background process using nohup and & command at end. I want to send output to a file say myprocess.out. So will this command work? nohup myprocess.ksh > myprocess.out & Thanks in advance guys !!! :) (3 Replies)
Discussion started by: vx04
3 Replies
sigqueue(3)						     Library Functions Manual						       sigqueue(3)

NAME
sigqueue - Queues a signal and data to a running process LIBRARY
Realtime Library (librt.so, librt.a) SYNOPSIS
#include <signal.h> int sigqueue ( pid_t pid, int signo, const union sigval value); PARAMETERS
pid Specifies the ID of the target process. signo Specifies the signal to be queued. If the signo parameter is 0 (the null signal), error checking is performed but no signal is sent. This can be used to check the validity of the pid parameter. value Specifies the application-defined value to be queued to the receiving process. DESCRIPTION
The sigqueue function causes the signal specified by signo to be sent with the value specified by value to the process specified by pid. The conditions required for a process to have permission to queue a signal to another process are the same as for the kill function. If the call is successful, the signal is queued to the specified process. If the process has the SA_SIGINFO flag enabled for the queued signal, the specified value is delivered to its signal handler as the si_value field of the siginfo parameter. Nonprivileged callers are restricted in the number of signals they can have actively queued. This per-process quota value can be returned with sysconf(_SC_SIGQUEUE_MAX). RETURN VALUES
Upon successful completion, the sigqueue function returns a value of 0 (zero). Otherwise, a value of -1 is returned and errno is set to indicate the error. ERRORS
If sigqueue fails, no signal is sent, and errno is set to one of the following values: [EAGAIN] No resources are available to queue the signal. The process has already queued {SIGQUEUE_MAX} signals that are still pending at the receiver(s), or a system-wide resource limit has been exceeded. [EINVAL] The signo parameter is not a valid signal number. [EINVAL] The signo parameter is SIGKILL, SIGSTOP, SIGTSTP, or SIGCONT, and the pid parameter is 1 (process 1 -- init). [ESRCH] No process can be found corresponding to that specified by the pid parameter. [EPERM] The real or saved user ID does not match the real or effective user ID of the receiving process, the calling process does not have appropriate privilege, or the process is not sending a SIGCONT signal to one of its session's processes. RELATED INFORMATION
Headers: siginfo(5) Functions: kill(2), sigaction(2), sysconf(3) Guide to Realtime Programming delim off sigqueue(3)
All times are GMT -4. The time now is 06:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy