History log of /freebsd-current/usr.sbin/daemon/daemon.8
Revision Date Author Comments
# 7618c9e1 25-Apr-2024 Juraj Lutter <otis@FreeBSD.org>

daemon: Add -C (--restart-count) option

Add a new option (-C, --restart-count) to specify the maximum
number of times that the controlled process is restarted if
restart (-r) is restarted.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44944


# a6f795cc 26-Dec-2023 Ihor Antonov <ihor@antonovs.family>

daemon: fix clang-tidy warnings

Fixed narrowing conversions:
- strtol replaced with strtonum with range check
- read returns ssize_t
- kevent.data explicitly cast to int before passing into strerror

While we we're here:
- Defined and documented maximum restart delay.
- Fixed typo in a comment.
- Remove unused includes

Reviewed by: cperciva, kevans


# c1207678 18-Sep-2023 Mateusz Piotrowski <0mp@FreeBSD.org>

daemon.8: Document -u sets HOME, USER, and SHELL

Fixes: 6b3ad1d73732 When -u option is used also set USER, HOME and SHELL
MFC after: 3 days


# ee23e1e4 18-Sep-2023 Mateusz Piotrowski <0mp@FreeBSD.org>

daemon.8: Sort options in DESCRIPTION

MFC after: 3 days


# a5bc8e8a 18-Sep-2023 Mateusz Piotrowski <0mp@FreeBSD.org>

daemon.8: Use Cm where appropriate

MFC after: 3 days


# 735637f7 18-Sep-2023 Mateusz Piotrowski <0mp@FreeBSD.org>

daemon.8: Use Dv for signal names

MFC after: 3 days


# fa9896e0 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line nroff pattern

Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/


# 0a402ad2 09-Feb-2023 Ihor Antonov <ihor@antonovs.family>

daemon: add long_opts

Long options improve readability of scripts, makes code comprehension
easier. This patch adds long options while preserving the existing CLI
interface.

Also --help/-h option is added.

Reviewed by: allanjude, pauamma (both earlier versions), kevans
Differential Revision: https://reviews.freebsd.org/D38244


# 54c743e5 14-Jan-2021 Mateusz Piotrowski <0mp@FreeBSD.org>

Fix a typo

"and" is not a flag.

MFC after: 3 days


# dffc6929 24-Sep-2020 Maxim Sobolev <sobomax@FreeBSD.org>

Fix a typo in the 366098.

Reported by: 0mp
MFC after: 2 weeks
(along with 366098)


# 4cd407ec 23-Sep-2020 Maxim Sobolev <sobomax@FreeBSD.org>

dd a new option (-H) to daemon(8) to catch SIGHUP and re-open output_file file when
received.

The default system log rotation mechanism (newsyslog(8)) requires ability to send
signal to a daemon in order to properly complete rotation of the logs in an "atomic"
manner without having to making a copy and truncating original file. Unfortunately
our built-in mechanism to convert "dumb" programs into daemons has no way to handle
this rotation properly. This change adds this ability, to be enabled by supplying -H
option in addition to the -o option.

Reviewed by: markj, rpokala (manpages)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26526


# b6fa976d 02-Oct-2019 Ian Lepore <ian@FreeBSD.org>

Bump .Dd for earlier update (should have been part of r353024).


# 0ec0f10d 02-Oct-2019 Ian Lepore <ian@FreeBSD.org>

Clarify how the -f option for daemon(8) interacts with other options
related to redirecting stdout and stderr.


# 4f6714d5 25-Mar-2019 Michael Gmelin <grembo@FreeBSD.org>

Correct contradictory information on default syslog logging priority.

MFC after: 1 week


# a641e445 09-Nov-2018 Mateusz Piotrowski <0mp@FreeBSD.org>

Cross-reference nohup(1) and daemon(8).

Reviewed by: bcr
Approved by: krion (mentor, implicit), mat (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D17920


# 26e19aca 31-Jul-2018 Mateusz Piotrowski <0mp@FreeBSD.org>

Add a missing "Ar" macro to the description of the -R flag in the manpage.

Approved by: bjk (doc committer), krion (mentor)
Differential Revision: https://reviews.freebsd.org/D16520


# c1ee3587 15-Apr-2018 Ian Lepore <ian@FreeBSD.org>

Fix cut-and-pasted line to have the right option letter.

Reported by: 0mp@
Pointy hat: ian@


# 37820b87 15-Apr-2018 Ian Lepore <ian@FreeBSD.org>

Add an option to daemon(8) to specify a delay between restarts of a
supervised program. The existing -r option has a hard-coded delay of one
second. This change adds a -R option which takes a delay in seconds. This
can be used to prevent log spam and rapid restarts, similar to init(8)'s
behavior of adding a delay between rapid restarts when it's supervising a
program.


# 53c2c791 26-Jan-2018 Maxim Konovalov <maxim@FreeBSD.org>

o A command line flag for the syslog_facility fixed in the SYNOPSIS.

PR: 225441


# 53d49b37 22-Oct-2016 Jilles Tjoelker <jilles@FreeBSD.org>

daemon: Allow logging daemon stdout/stderr to file or syslog.

There are various new options, documented in the man page, to send the
daemon's standard output and/or standard error to a file or to syslog.

Submitted by: ank at iki.fi
Reviewed by: wblock (man page only)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D7993


# 112bfcf5 02-Mar-2016 Conrad Meyer <cem@FreeBSD.org>

daemon(8): Add -t option to set process title

The default process title is taken from the argv[0] value (any
particular hardlink name). Add a -t option to override the default.

PR: 205016
Submitted by: Yuri <yuri@rawbw.com>
No objection from: freebsd-current@
Sponsored by: EMC / Isilon Storage Division


# 40e463f4 13-Sep-2013 Joel Dahl <joel@FreeBSD.org>

mdoc: remove EOL whitespace.

Approved by: re (blanket)


# 32b17786 13-Sep-2013 John-Mark Gurney <jmg@FreeBSD.org>

add support for writing the pid of the daemon program to a pid file so
that daemon can be used w/ rc.subr and ports can use the additional
functionality, such as keeping the ldap daemon up and running, and have
the proper program to signal to exit..

PR: bin/181341
Submitted by: feld
Approved by: re (glebius)


# 76462499 04-Jun-2012 Mikolaj Golub <trociny@FreeBSD.org>

Document -r option in SYNOPSIS and usage statement.

Submitted by: Andrey Zonov <andrey zonov.org>
MFC after: 3 days


# b6193c24 19-Feb-2012 Mikolaj Golub <trociny@FreeBSD.org>

Add -r option to restart the program if it has been terminated.

Suggested by: Andrey Zonov <andrey zonov org>
MFC after: 2 weeks


# 195fc497 19-Feb-2012 Mikolaj Golub <trociny@FreeBSD.org>

If the supervising process receives SIGTERM, forward it to the spawned
process. Normally it will cause the child to exit followed by the
termination of the supervisor after removing the pidfile.

This looks like desirable behavior, because termination of a
supervisor usually supposes termination of its charge. Also it will
fix the issue with stale pid files after reboot due to init kills a
supervisor before its child exits.

MFC after: 2 weeks


# 2ad43027 19-Feb-2012 Mikolaj Golub <trociny@FreeBSD.org>

The pidfile_open(3) is going to be fixed to set close-on-exec in order
not to leak the descriptor after exec(3). This raises the issue for
daemon(3) of the pidfile lock to be lost when the child process
executes.

To solve this and also to have the pidfile cleaned up when the program
exits, if a pidfile is specified, spawn a child to exec the command
and wait in the parent keeping the pidfile locked until the child
process exits and remove the file.

Reported by: Andrey Zonov <andrey zonov org>
Suggested by: pjd
Reviewed by: pjd
MFC after: 2 weeks


# b34650e3 01-Feb-2012 Guy Helmer <ghelmer@FreeBSD.org>

Change the notes about the pidfile to include Doug's preference
for pre-creating the pidfile with appropriate owner and permissions.

Requested by dougb


# 704523b0 25-Jan-2012 Guy Helmer <ghelmer@FreeBSD.org>

Revert 229667: After some discussion of this change, it seems it is
better to leave the pidfile open where it was. Add a note to the
man page describing pidfile strategies to use if the daemon is to
be run as a user other than root.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 27ad5065 17-May-2010 Ivan Voras <ivoras@FreeBSD.org>

Slightly improve wording.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# e6d4b388 18-Mar-2007 Tom Rhodes <trhodes@FreeBSD.org>

Improve previous commit by using setusercontext(3) and removing the group
option. Bump doc date for manual page changes.

Reviewed by: rwatson, ru, will (older version)


# 12d7249e 09-Mar-2007 Tom Rhodes <trhodes@FreeBSD.org>

Add support for dropping privileges to a specified user and/or group.

PR: 108523
Submitted by: Dmitri Alenitchev <dmitri@dworlds.ru> (original version)
Reviewed by: mpp (first reply to PR)


# c6262cb6 24-Aug-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Teach daemon(8) how to use pidfile(3).


# a866e170 17-Jan-2005 Ruslan Ermilov <ru@FreeBSD.org>

Added the EXIT STATUS section where appropriate.


# 2410103c 07-Jul-2004 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) fixes.


# 846be7bd 02-Jun-2004 Poul-Henning Kamp <phk@FreeBSD.org>

Give daemon(8) the ability to create a pid-file. Since the target program
does not know anything about the pid-file and we don't keep a babysitting
process for the task, the pid-file will linger.

Submitted by: mi
PR: 56398


# a7d4e017 05-Feb-2003 Tom Rhodes <trhodes@FreeBSD.org>

MFS: 1.2.2.2


# 217758f8 30-Aug-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: minor formatting tweaks.


# bd06a3ec 29-Aug-2001 Mike Barcroft <mike@FreeBSD.org>

Add a new utility that runs an executable detached from the
controlling terminal.

Discussed on: -hackers
Obtained from: BSD/OS