Sponsored Content
Full Discussion: fg help
Operating Systems AIX fg help Post 302229685 by pallak7 on Wednesday 27th of August 2008 03:24:55 PM
Old 08-27-2008
fg help

I started a Java process via SSH that I knew was going to take a long time to run so I backgrounded it and let my SSH session expire. I logged back in to check up on it (it prints its output to stdout, and a summary to a log file when it's finished) and tried to pull it in to the foreground but wasn't able to. The fg man page says this:
Quote:
fg [JobID]

The JobID parameter can be a process ID number, or you can use one of the following symbol combinations:...
Code:
fg <PID>

and I got this error:
Quote:
/bin/ksh: fg: 0403-002 The specified job does not exist.
I also tried just plain old fg as it was the last process that I sent to the background and I received the same error. The output of ps -ef | grep java confirms that the PID is in fact correct and that the process is still running. What gives?
 
setsid(2)							   System Calls 							 setsid(2)

NAME
setsid - create session and set process group ID SYNOPSIS
#include <sys/types.h> #include <unistd.h> pid_t setsid(void); DESCRIPTION
The setsid() function creates a new session, if the calling process is not a process group leader. Upon return the calling process will be the session leader of this new session, will be the process group leader of a new process group, and will have no controlling terminal. The process group ID of the calling process will be set equal to the process ID of the calling process. The calling process will be the only process in the new process group and the only process in the new session. RETURN VALUES
Upon successful completion, setsid() returns the value of the process group ID of the calling process. Otherwise it returns (pid_t)-1 and sets errno to indicate the error. ERRORS
The setsid() function will fail if: EPERM The calling process is already a process group leader, or the process group ID of a process other than the calling process matches the process ID of the calling process. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Async-Signal-Safe | +-----------------------------+-----------------------------+ SEE ALSO
getsid(2), setpgid(2), setpgrp(2), attributes(5), standards(5) WARNINGS
A call to setsid() by a process that is a process group leader will fail. A process can become a process group leader by being the last member of a pipeline started by a job control shell. Thus, a process that expects to be part of a pipeline, and that calls setsid(), should always first fork; the parent should exit and the child should call setsid(). This will ensure that the calling process will work reliably when started by both job control shells and non-job control shells. SunOS 5.10 21 Aug 2002 setsid(2)
All times are GMT -4. The time now is 11:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy