DAEMON(3) Library Functions Manual DAEMON(3)NAME
daemon - run in the background
int nochdir, noclose;
The daemon function is for programs wishing to detach themselves from the controlling terminal and run in the background as system daemons.
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''.
The function daemon may fail and set errno for any of the errors specified for the library functions fork(2).
SEE ALSO fork(2), ioctl(2).
The daemon function first appeared in 4.4BSD.
4th Berkeley Distribution February 3, 1995 DAEMON(3)
Check Out this Related Man Page
DAEMON(3) BSD Library Functions Manual DAEMON(3)NAME
daemon -- run in the background
Standard C Library (libc, -lc)
daemon(int nochdir, int noclose);
The daemon() function is for programs wishing to detach themselves from the controlling terminal and run in the background as system daemons.
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.
On return 0 indicates success with -1 indicating error.
The function daemon() 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)HISTORY
The daemon() function first appeared in 4.4BSD.
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 output
or standard error have been closed before the program was run. Programs using daemon() should therefore make sure to either call daemon()
before opening any files or sockets or, alternately, verifying that any file descriptors obtained have a value greater than 2.
daemon() uses fork() as part of its tty detachment mechanism. Consequently the process id changes when daemon() is invoked. Processes
employing daemon() can not be reliably waited upon until daemon() has been invoked.
BSD September 3, 1999 BSD
I need to use the RSH command to run a shell script on my Unix box from Win 2000. I'm using the etc/hosts.equiv file for configuring Unix. In it I have the hostname and username as required. As a test, I enter the following on the Win 2000 dos command: rsh servername -l username df -k.
The... (8 Replies)
Does anyone know the command to start the DNS Daemon.
I looked in the /etc/init.d/inetsvc file and it tells me what the text should look like. When I go to open the corresponding files they are encoded and I can't read them.
So is there a command that will start the DNS daemon?
If... (8 Replies)
I'm in Solaris 2.8 env. When i'm trying to add a ftp user account ,
encountered "no space in disk" .. couldn't create any user. Then check the fs disk space with "df - k " and /var/adm/syslog .. got the below message.
Jun 9 03:10:53 mail sendmail: NOQUEUE: low on space
(have 0,... (10 Replies)
I have been a Macintosh user for many, many years. As you may know the latest MacOS ( OS X ) is UNIX based. (Please see http://www.apple.com/macosx/technologies/inside.html for more information.) Basically, I really have no idea where to start with UNIX...if anyone could take a quick... (7 Replies)
I have a multithreaded daemon(server) which will accept connections from various clients and sends back results to them.
In order to serve my daemon clients, it has to establish a TCP connection to another server(vendor supplied which is listening on a specific TCP port) and gets the... (11 Replies)
I'm running a FreedBSD server with mysql 4.1. When I start mysqld via the command:
# /usr/local/bin/safe_mysqld --user=mysql
it starts the mysql db (I know because the websites are running off of it) but does not return to a prompt, it will let me type but will not respond unless I restart... (15 Replies)
I have a directory where sometimes a file will come (in a name format say file001.txt).
I want to run a job (.ksh file) as soon as a new file comes into the directory.
How can I write a shell script which will run in the background and monitor arrival of new file in the directory?
... (11 Replies)
In SunOS 10, I have some cron jobs and it is running fine but the cron job outputs are not mailing to any acount of the system.
In other OS, we have option like MAILTO variable or /dev/null to disable but in Sun I have no idea how it is disabled by default and how do I... (13 Replies)
I need to run an application (Hudson) listening to port 8080 on a remote Solaris server. I have managed to start that application and tried to access it with my browser from my local PC, but unsuccessfully.
I need to find out what is blocking the access to that port (or any other). A... (9 Replies)
Hi all I have been having this error in dmesg for quite some time and I'm not sure what's the errors associate with it. The closest I can get is the error in the fd2log,
mv: cannot rename pacct.0 to SPacct.0.xxxx: Permission denied
I initially solved the problem by setting the folder group... (9 Replies)
Is it possible to call a remote function in another daemon? Here is the setup:
I have two daemons daemon A with function "s" and daemon B with function "k". I need a way function "s" from daemon A to call a function "k" from daemon B and pass some arguments. When the request is ... (13 Replies)
I have installed version of ntop 4.0.3 by guide.
But I can't start ntop daemon/service. I didn't find a service file for starting.
During the installation there was no problem only want to RRDTool so I installed that. Now there is no necessary package required.
I didn't find in /etc/init.d/... (9 Replies)
I'm rather new to scripting with the shell (I started on Wednesday) and encountered a problem that left me clueless.
I moved to an old house recently and the sound of the 433mhz door bell is too quiet. Since I always wanted to start playing around with a raspberry pi and my wife... (11 Replies)
Hello all and happy new year.
I have an HP-UX system running HP-UX B.11.31 U ia64 1161301486 and it has a weird process called "svhptdaemon" that's using 100% of the CPU. Anyon knows what this process is? I've tried googling the answer but even Google doesn't know :eek:
CPU TTY PID... (13 Replies)