question: for the below program
i just printed the value for pid, child pid and parent pid
why does it give me 6 values? i assume ppid is 28086
but can't figure out why there are 5 values printed instead of just two!
can someone comment on that!
#include<stdio.h>
#define DIM 8
int... (3 Replies)
The below command returns full line.How can i get only PID from this line ie 15794 from the below example
(FI NY) nbswpsa52.ny.ficc.gs.com~ ->ps -ef | grep keepalive | grep -v keepaliveStub | grep -v swapback | grep -v grep
ficctprd 15794 1 0 13:12:58 ? 0:01 keepalive (3 Replies)
Hi ,
I am trying to get the PID using the following command:
$ /usr/ucb/ps -auwwwwx | grep java | grep Proceess | ptree PID or
$ /usr/ucb/ps -auwwwwx | grep java | grep Proceess;ptree PID
it is possible to get PID, such that I check whether any orphan
process is running.
solution... (0 Replies)
1. If I use an software application(which connects to the database in the server) in my local pc, how many PID should be registered? Would there be PID for the session and another PID for socket connection?
2. I noticed (through netstat) that when I logged in using the my software application,... (1 Reply)
Hi All,
In my project i have two process runs in the back end.
Once i start my project, and execute the command ps, i get below output:
PID TTY TIME CMD
9086 pts/1 0:00 ksh
9241 pts/1 0:02 java
9240 pts/1 0:00 shell_script_bg
java with 9241 PID is the main... (4 Replies)
Hi,
I need to get the pid of a process and have to store the pid in a variable and i want to use this value(pid) of the variable for some process. Please can anyone tell me how to get the pid of a process and store it in a variable. please help me on this.
Thanks in advance,
Amudha (7 Replies)
Hello people,
This question might seem to be a little naive but here it goes:
I want to know the PID of a script that is running in the background.
eg: There is a script called Data_Downloader.sh
I am using the command:
ps -ef | grep Data_Downloader.sh
But I am getting the output as
wrkarea... (9 Replies)
I have searched to find an anwer to no avail, I hope you can help me.
I have a.ksh that many people call and a.ksh calls b.ksh
b.ksh is also invoked stand-alone by many people as well
In b.ksh I want to do something different if it was not involked by a.ksh.
How can I do this? (7 Replies)
Hello,
I would like to know what this command means?
PID=$!
what does "!" stand for? (5 Replies)
Discussion started by: googlietdr
5 Replies
LEARN ABOUT OSX
daemon
DAEMON(3) BSD Library Functions Manual DAEMON(3)NAME
daemon -- run in the background
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <stdlib.h>
int
daemon(int nochdir, int noclose);
DESCRIPTION
The daemon() function is for programs wishing to detach themselves from the controlling terminal and run in the background as system daemons.
On Mac OS X, the use of this API is discouraged in favor of using launchd(8).
Unless the argument nochdir is non-zero, daemon() changes the current working directory to the root (/).
Unless the argument noclose is non-zero, daemon() will redirect standard input, standard output, and standard error to /dev/null.
RETURN VALUES
The daemon() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate
the error.
ERRORS
The daemon() function may fail and set errno for any of the errors specified for the library functions fork(2) and setsid(2).
SEE ALSO fork(2), setsid(2), sigaction(2)HISTORY
The daemon() function first appeared in 4.4BSD.
CAVEATS
Unless the noclose argument is non-zero, daemon() will close the first three file descriptors and redirect them to /dev/null. Normally,
these correspond to standard input, standard output, and standard error. However, if any of those file descriptors refer to something else,
they will still be closed, resulting in incorrect behavior of the calling program. This can happen if any of standard input, standard out-
put, or standard error have been closed before the program was run. Programs using daemon() should therefore either call daemon() before
opening any files or sockets, or verify that any file descriptors obtained have values greater than 2.
The daemon() function temporarily ignores SIGHUP while calling setsid(2) to prevent a parent session group leader's calls to fork(2) and then
_exit(2) from prematurely terminating the child process.
BSD June 9, 1993 BSD