diff options
Diffstat (limited to 'community/below/below.initd')
-rw-r--r-- | community/below/below.initd | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/community/below/below.initd b/community/below/below.initd new file mode 100644 index 00000000000..cfdfe13fa06 --- /dev/null +++ b/community/below/below.initd @@ -0,0 +1,43 @@ +#!/sbin/openrc-run + +description="System monitor recording daemon" + +command="/usr/bin/below" +command_args="${cfgfile:+"--config $cfgfile"} record $command_args" +command_background="yes" +pidfile="/run/$RC_SVCNAME.pid" + +depend() { + need cgroups + after ntp-client +} + +start_pre() { + if [ "$rc_cgroup_mode" != "unified" ]; then + eerror "below requires rc_cgroup_mode=unified, but current is '$rc_cgroup_mode' (see /etc/rc.conf)" + return 1 + fi + + command_args="$command_args + $(togif --collect-io-stat "$collect_io_stat") + $(togif --compress "$compress") + $(optif --dict-compress-chunk-size "$dict_compress_chunk_size") + $(togif --disable-disk-stat "$disable_disk_stat") + $(togif --disable-exitstats "$disable_exitstats") + $(optif --interval-s "$interval") + $(optif --port "$port") + $(optif --retain-for-s "$retain_for") + $(optif --service-identity "$service_identity") + $(optif --skew-detection-threshold-ms "$skew_detection_threshold") + $(optif --store-size-limit "$store_size_limit") + " + return 0 +} + +optif() { + test -n "$2" && printf '%s\n' "$1 $2" +} + +togif() { + yesno "$2" && printf '%s\n' "$1" +} |