bitcoin/contrib/init
Carl Dong 689a65d878 contrib/init: Better systemd integration
1. Make logs available to journalctl (systemd's logging system) by not
   specifying -daemonwait, which rightfully has its own set of stdout
   and stderr descriptors (a user invoking with -daemonwait on the
   command line should not see any logs). It makes more sense not to
   daemonize in the systemd context anyway.

2. Make systemd aware of when bitcoind is started and in steady state by
   specifying -startupnotify='systemd-notify --ready' and Type=notify.
   NotifyAccess=all is necessary so that the spawned thread for
   startupnotify is allowed to inform systemd of bitcoind's readiness.

   Note that NotifyAccess=exec won't work because it only allows
   sd_notify readiness signalling from Exec*= declarations in the
   .service file.

3. Also make systemd aware of when bitcoind is stopping by specifying
   -shutdownnotify='systemd-notify --stopping'

Note that we currently don't allow multiple *notify commands, but users
can override it in systemd via:

  # systemctl edit bitcoind

By specifying something like:

  [Service]
  ExecStart=/usr/bin/bitcoind -pid=/run/bitcoind/bitcoind.pid \
                              -conf=/etc/bitcoin/bitcoin.conf \
                              -datadir=/var/lib/bitcoind \
                              -startupnotify='systemd-notify --ready; mystartupcommandhere' \
                              -shutdownnotify='systemd-notify --stopping; myshutdowncommandhere'
2023-05-28 13:10:30 -04:00
..
bitcoind.conf Set init stop timeout to 10 min 2019-09-06 17:03:04 +02:00
bitcoind.init Set init stop timeout to 10 min 2019-09-06 17:03:04 +02:00
bitcoind.openrc contrib/init: (OpenRC) quote some unquoted variables. 2021-02-11 00:09:42 +01:00
bitcoind.openrcconf Set init stop timeout to 10 min 2019-09-06 17:03:04 +02:00
bitcoind.service contrib/init: Better systemd integration 2023-05-28 13:10:30 -04:00
org.bitcoin.bitcoind.plist Fix launchctl not being able to stop bitcoind 2017-09-29 10:54:10 +02:00
README.md doc: Fix systemd spelling and link to doc/init.md 2021-01-08 17:55:34 +02:00

Sample configuration files for:

systemd: bitcoind.service
Upstart: bitcoind.conf
OpenRC:  bitcoind.openrc
         bitcoind.openrcconf
CentOS:  bitcoind.init
macOS:   org.bitcoin.bitcoind.plist

have been made available to assist packagers in creating node packages here.

See doc/init.md for more information.