1bd06a3ecSMike Barcroft.\" Copyright (c) 1999 Berkeley Software Design, Inc. All rights reserved. 2bd06a3ecSMike Barcroft.\" 3bd06a3ecSMike Barcroft.\" Redistribution and use in source and binary forms, with or without 4bd06a3ecSMike Barcroft.\" modification, are permitted provided that the following conditions 5bd06a3ecSMike Barcroft.\" are met: 6bd06a3ecSMike Barcroft.\" 1. Redistributions of source code must retain the above copyright 7bd06a3ecSMike Barcroft.\" notice, this list of conditions and the following disclaimer. 8bd06a3ecSMike Barcroft.\" 2. Redistributions in binary form must reproduce the above copyright 9bd06a3ecSMike Barcroft.\" notice, this list of conditions and the following disclaimer in the 10bd06a3ecSMike Barcroft.\" documentation and/or other materials provided with the distribution. 11bd06a3ecSMike Barcroft.\" 3. Berkeley Software Design Inc's name may not be used to endorse or 12bd06a3ecSMike Barcroft.\" promote products derived from this software without specific prior 13bd06a3ecSMike Barcroft.\" written permission. 14bd06a3ecSMike Barcroft.\" 15bd06a3ecSMike Barcroft.\" THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND 16bd06a3ecSMike Barcroft.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17bd06a3ecSMike Barcroft.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18bd06a3ecSMike Barcroft.\" ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE 19bd06a3ecSMike Barcroft.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20bd06a3ecSMike Barcroft.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21bd06a3ecSMike Barcroft.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22bd06a3ecSMike Barcroft.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23bd06a3ecSMike Barcroft.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24bd06a3ecSMike Barcroft.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25bd06a3ecSMike Barcroft.\" SUCH DAMAGE. 26bd06a3ecSMike Barcroft.\" 27bd06a3ecSMike Barcroft.\" $FreeBSD$ 28bd06a3ecSMike Barcroft.\" 2912d7249eSTom Rhodes.Dd March 9, 2007 30bd06a3ecSMike Barcroft.Dt DAEMON 8 31217758f8SRuslan Ermilov.Os 32bd06a3ecSMike Barcroft.Sh NAME 33bd06a3ecSMike Barcroft.Nm daemon 34bd06a3ecSMike Barcroft.Nd run detached from the controlling terminal 35bd06a3ecSMike Barcroft.Sh SYNOPSIS 36217758f8SRuslan Ermilov.Nm 37bd06a3ecSMike Barcroft.Op Fl cf 3812d7249eSTom Rhodes.Op Fl u Ar user 3912d7249eSTom Rhodes.Op Fl g Ar group 40846be7bdSPoul-Henning Kamp.Op Fl p Ar pidfile 41217758f8SRuslan Ermilov.Ar command arguments ... 42bd06a3ecSMike Barcroft.Sh DESCRIPTION 43bd06a3ecSMike BarcroftThe 44bd06a3ecSMike Barcroft.Nm 45bd06a3ecSMike Barcroftutility detaches itself from the controlling terminal and 46bd06a3ecSMike Barcroftexecutes the program specified by its arguments. 4712d7249eSTom RhodesPrivileges may be lowered to specified user and/or group. 48bd06a3ecSMike Barcroft.Pp 49bd06a3ecSMike BarcroftThe options are as follows: 50217758f8SRuslan Ermilov.Bl -tag -width indent 51bd06a3ecSMike Barcroft.It Fl c 52217758f8SRuslan ErmilovChange the current working directory to the root 53217758f8SRuslan Ermilov.Pq Dq Pa / . 54bd06a3ecSMike Barcroft.It Fl f 55bd06a3ecSMike BarcroftRedirect standard input, standard output and standard error to 56bd06a3ecSMike Barcroft.Pa /dev/null . 5712d7249eSTom Rhodes.It Fl g Ar group 5812d7249eSTom RhodesDrop privileges to specified group. 59846be7bdSPoul-Henning Kamp.It Fl p Ar file 602410103cSRuslan ErmilovWrite the ID of the created process into the 61c6262cb6SPawel Jakub Dawidek.Ar file 62c6262cb6SPawel Jakub Dawidekusing 6312d7249eSTom Rhodes.It Fl u Ar user 6412d7249eSTom RhodesDrop privileges to specified user. 65c6262cb6SPawel Jakub Dawidek.Xr pidfile 3 66c6262cb6SPawel Jakub Dawidekfunctionality. 67846be7bdSPoul-Henning KampNote, that the file will be created shortly before the process is 68846be7bdSPoul-Henning Kampactually executed, and will remain after the process exits (although 69846be7bdSPoul-Henning Kampit will be removed if the execution fails). 70bd06a3ecSMike Barcroft.El 71a866e170SRuslan Ermilov.Sh EXIT STATUS 72bd06a3ecSMike BarcroftThe 73bd06a3ecSMike Barcroft.Nm 74bd06a3ecSMike Barcroftutility exits 1 if an error is returned by the 75bd06a3ecSMike Barcroft.Xr daemon 3 762410103cSRuslan Ermilovlibrary routine, 2 if the 772410103cSRuslan Ermilov.Ar pidfile 78c6262cb6SPawel Jakub Dawidekis requested, but cannot be opened, 3 if process is already running (pidfile 79c6262cb6SPawel Jakub Dawidekexists and is locked), 80846be7bdSPoul-Henning Kampotherwise 0. 81a866e170SRuslan Ermilov.Sh DIAGNOSTICS 82bd06a3ecSMike BarcroftIf the command cannot be executed, an error message is displayed on 83bd06a3ecSMike Barcroftstandard error unless the 84bd06a3ecSMike Barcroft.Fl f 85bd06a3ecSMike Barcroftflag is specified. 86bd06a3ecSMike Barcroft.Sh SEE ALSO 8712d7249eSTom Rhodes.Xr setregid 2 , 8812d7249eSTom Rhodes.Xr setreuid 2 , 89bd06a3ecSMike Barcroft.Xr daemon 3 , 90bd06a3ecSMike Barcroft.Xr exec 3 , 91c6262cb6SPawel Jakub Dawidek.Xr pidfile 3 , 92bd06a3ecSMike Barcroft.Xr termios 4 , 93bd06a3ecSMike Barcroft.Xr tty 4 94bd06a3ecSMike Barcroft.Sh HISTORY 95bd06a3ecSMike BarcroftThe 96bd06a3ecSMike Barcroft.Nm 97bd06a3ecSMike Barcroftutility first appeared in 98a7d4e017STom Rhodes.Fx 4.7 . 99