Add /lib/finit/sample.conf for initctl create

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-02-28 10:26:39 +01:00
parent 544180aa0b
commit 2bfede2cfe
4 changed files with 53 additions and 3 deletions
+2
View File
@@ -216,6 +216,8 @@ AC_DEFINE_UNQUOTED(PLUGIN_PATH, "$plugin_path", [Finit plugin path])
AC_EXPAND_DIR(rescue_conf, "$libdir/finit/rescue.conf")
AC_DEFINE_UNQUOTED(RESCUE_CONF, "$rescue_conf", [Finit rescue mode .conf])
AC_EXPAND_DIR(sample_conf, "$libdir/finit/sample.conf")
AC_DEFINE_UNQUOTED(SAMPLE_CONF, "$sample_conf", [Finit sameple.conf for initctl create])
# Generate all files
AC_OUTPUT
+2 -2
View File
@@ -1,4 +1,4 @@
EXTRA_DIST = rescue.conf cgreaper.sh
EXTRA_DIST = cgreaper.sh rescue.conf sample.conf
AM_CPPFLAGS = -U_FORTIFY_SOURCE
AM_CPPFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_GNU_SOURCE -D_DEFAULT_SOURCE
if STATIC
@@ -12,7 +12,7 @@ sbin_PROGRAMS = finit initctl
pkglibexec_SCRIPTS = cgreaper.sh
finit_pkglibdir = $(pkglibdir)
finit_pkglib_SCRIPTS = rescue.conf
finit_pkglib_SCRIPTS = rescue.conf sample.conf
if WATCHDOGD
pkglibexec_PROGRAMS = watchdogd
+45
View File
@@ -0,0 +1,45 @@
# sample.conf: template run/task/service stanza for finit
#
# The one-shot commands 'run' and 'task' are called only once per
# runlevel. Finit does not restart them when they exit.
#
# - run : wait for completion before continuing with next stanza
# - task : like run but started in background, parallell with other stanzas
# - service : supervised daemon, run in foreground, restarted if it crashes
#
# The env: is an optional path to a file with environment variables to
# adjust the behavior of daemons. Debian and Buildroot use /etc/default
# while Alpine use /etc/conf.d -- ensure your Finit is built correctly.
# The leading '-' determines if its OK to start the service even if the
# env file is missing.
#
# run [LVLS] <COND> log command ARGS -- Command
# task [LVLS] <COND> log command ARGS -- Command
# service [LVLS] <COND> log env:[-]/etc/default/daemon daemon ARGS -- Daemon daemon
# ^ ^ ^ ^ ^ ^ ^ ^
# | | | | | | | `-- Optional description
# | | | | | | `----------- Daemon arguments
# | | | | | `-------------------------- Path to daemon
# | | | | `---------------------------------------------------- Optional env. file
# | | | `-------------------------------------------------------- Redirect output to log
# | | `--------------------------------------------------------------- Optional conditions
# | `---------------------------------------------------------------------- Optional Runlevels
# `------------------------------------------------------------------------------ Monitored application
# Debian GNU/Linux: start SSH daemon as soon as basic networking comes up
#service [2345] <net/lo/up> env:-/etc/default/ssh /usr/sbin/sshd -D $SSHD_OPTS -- OpenSSH daemon
# Alpine Linux: Oneshot task to run once at bootstrap, yes pipes are possible :)
#task [S] env:/etc/conf.d/loadkmap zcat $KEYMAP | loadkmap -- Loading keymap
# Alpine Linux: start SSH daemon with $DROPBEAR_OPTS from /etc/conf.d
#service [2345] env:-/etc/conf.d/dropbear dropbear -R -F $DROPBEAR_OPTS -- Dropbear SSH daemon
# Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager)
# Depends on syslogd having started. Redirect any output to log.
#service [2345] <pid/syslogd> log acpid -f -- ACPI daemon
# Start rsyslogd as soon as possible, should always run
# Provides pid/syslogd condition
#service [S12345] name:syslogd env:-/etc/default/rsyslog rsyslogd -n $RSYSLOGD_OPTIONS -- Reliable syslog daemon
+4 -1
View File
@@ -263,7 +263,10 @@ static int do_edit(char *arg, int creat)
return serv_list("available");
}
/* XXX: fill with template/commented-out examples */
#ifdef SAMPLE_CONF
/* Try copying file, it may have been removed by sysop */
copyfile(SAMPLE_CONF, fn, 0, 0);
#endif
} else if (creat)
warnx("the file %s already exists, falling back to edit.", fn);