From 2205f72a2e95d7bde545165cae05ecc9460b04e7 Mon Sep 17 00:00:00 2001 From: fbt Date: Thu, 13 Jul 2017 16:09:42 +0300 Subject: [PATCH] watchman -> ssm Signed-off-by: fbt --- init.d/acpid | 6 ++--- init.d/agetty | 2 +- init.d/alsa | 2 +- init.d/atd | 5 ++--- init.d/binfmt-register | 18 +++++++++++++++ init.d/bitlbee | 2 +- init.d/cgmanager | 3 +++ init.d/chef-client | 2 +- init.d/chrony | 2 +- init.d/cjdroute | 51 +++++++----------------------------------- init.d/connmand | 2 +- init.d/cronie | 4 ++++ init.d/cupsd | 2 +- init.d/dbus | 9 ++------ init.d/devfs-links | 2 +- init.d/dhcpcd | 2 +- init.d/dnscrypt | 2 +- init.d/dnscrypt-backup | 2 +- init.d/docker | 11 ++++----- init.d/dropbear | 2 +- init.d/eudev | 8 +++---- init.d/fcgiwrap | 2 +- init.d/fsck | 19 ++++++++++------ init.d/haproxy | 5 +++++ init.d/haveged | 4 ++++ init.d/hostname | 2 +- init.d/hwdetect | 13 +++++------ init.d/iptables | 15 +++++++------ init.d/isc-dhcpd | 2 +- init.d/kmscon | 2 +- init.d/libvirtd | 2 +- init.d/lo.iface | 19 ++++------------ init.d/mariadb | 2 +- init.d/mdev | 2 +- init.d/memcached | 2 +- init.d/motd | 4 ++++ init.d/mount | 11 ++++----- init.d/mpd | 2 +- init.d/network | 10 +++++++++ init.d/ngetty | 2 +- init.d/nginx | 15 +++++-------- init.d/nrpe | 2 +- init.d/ntp | 2 +- init.d/oidentd | 2 +- init.d/openntpd | 2 +- init.d/openvpn | 2 +- init.d/openvpn-server | 2 +- init.d/pamusb | 2 +- init.d/php-fpm | 2 +- init.d/preload | 2 +- init.d/privoxy | 14 ++---------- init.d/prosody | 2 +- init.d/rc.local | 10 ++------- init.d/rsyslogd | 2 +- init.d/scron | 2 +- init.d/sdhcp | 7 ++++++ init.d/smdev | 2 +- init.d/sshd | 8 +++++-- init.d/sysctl | 10 +-------- init.d/syslog-ng | 2 +- init.d/systemd-udevd | 6 ++--- init.d/teamviewerd | 2 +- init.d/tinc | 2 +- init.d/unbound | 19 +++++----------- init.d/userrc | 4 ++++ init.d/vdevd | 2 +- init.d/vixie-cron | 2 +- init.d/wpa_supplicant | 5 +++++ init.d/xinetd | 2 +- init.d/znet | 12 +++++----- init.d/zt | 3 +++ 71 files changed, 198 insertions(+), 212 deletions(-) create mode 100755 init.d/binfmt-register create mode 100755 init.d/cgmanager create mode 100755 init.d/cronie create mode 100755 init.d/haproxy create mode 100755 init.d/haveged create mode 100644 init.d/motd create mode 100755 init.d/network create mode 100755 init.d/sdhcp create mode 100755 init.d/userrc create mode 100755 init.d/wpa_supplicant create mode 100644 init.d/zt diff --git a/init.d/acpid b/init.d/acpid index 109d715..9e87f3d 100755 --- a/init.d/acpid +++ b/init.d/acpid @@ -1,5 +1,5 @@ -#!/usr/bin/env watchman - -#service_respawn='true' +#!/usr/bin/env ssm + +service_respawn='true' service_command='/usr/bin/acpid' service_args=( -f ) diff --git a/init.d/agetty b/init.d/agetty index fdc9ed2..44fe63c 100755 --- a/init.d/agetty +++ b/init.d/agetty @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm service_respawn='true' service_command='/usr/bin/agetty' diff --git a/init.d/alsa b/init.d/alsa index cd0c135..762bb56 100755 --- a/init.d/alsa +++ b/init.d/alsa @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn='true' service_command='/usr/bin/alsactl' diff --git a/init.d/atd b/init.d/atd index 1b37e5c..24a83b9 100644 --- a/init.d/atd +++ b/init.d/atd @@ -1,5 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm service_respawn=true -service_command='/usr/bin/atd' -service_args=( -f ) +service_command=( /usr/bin/atd -f ) diff --git a/init.d/binfmt-register b/init.d/binfmt-register new file mode 100755 index 0000000..7bf9b33 --- /dev/null +++ b/init.d/binfmt-register @@ -0,0 +1,18 @@ +#!/usr/bin/watchman + +service_type=oneshot +service_command=( /usr/bin/true ) + +pre_start() { + echo '1' > /proc/sys/fs/binfmt_misc/status || return 1 + + if [[ -d /etc/binfmt.d ]]; then + for i in /etc/binfmt.d/*; do + cat "$i" > /proc/sys/fs/binfmt_misc/register || return 1 + done + fi +} + +pre_stop() { + echo '-1' > /proc/sys/fs/binfmt_misc/status || return 1 +} diff --git a/init.d/bitlbee b/init.d/bitlbee index f42e652..e8427a8 100755 --- a/init.d/bitlbee +++ b/init.d/bitlbee @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm # This script is intended for Daemon mode. # Modify it for your setup. diff --git a/init.d/cgmanager b/init.d/cgmanager new file mode 100755 index 0000000..a80a209 --- /dev/null +++ b/init.d/cgmanager @@ -0,0 +1,3 @@ +#!/usr/bin/env ssm + +service_command='/usr/bin/cgmanager' diff --git a/init.d/chef-client b/init.d/chef-client index e32aca0..e476775 100755 --- a/init.d/chef-client +++ b/init.d/chef-client @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn=true service_command='/usr/bin/chef-client' diff --git a/init.d/chrony b/init.d/chrony index 35b7fb9..cba37d0 100755 --- a/init.d/chrony +++ b/init.d/chrony @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn='true' service_command='/usr/bin/chronyd' diff --git a/init.d/cjdroute b/init.d/cjdroute index c8b527c..a904943 100755 --- a/init.d/cjdroute +++ b/init.d/cjdroute @@ -1,63 +1,28 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm # Two warnings: # 1) This script uses a script to run cjdroute and feed it -# the config. It can be found in the main cjdns repo: -# contrib/sh/run-cjdroute.sh -# Or here: http://ix.io/fYT +# the config. It can be found in the main cjdns repo: +# contrib/sh/run-cjdroute.sh +# Or here: http://ix.io/fYT # 2) service_respawn is disabled by default because you need # "noBackground":1 in cjdroute.conf for it to actually work. # Barely. unset reload -#service_respawn=true +service_respawn=true service_command='/usr/bin/run-cjdroute' cjdroute_admin_port='11234' cjdroute.check_tun_module() { [[ -e '/dev/net/tun' ]] || { modprobe tun || { - watchman.err "Could not load module tun!" + printf 'Could not load module tun!\n' return 1 } } } -start() { - if cjdroute.check_tun_module; then - watchman.start - fi -} - -get_control_pid() { - lsof -i :"$cjdroute_admin_port" | tail -1 | cut -d ' ' -f 2 -} - -status() { - # Check the actual cjdroute process and not the watchdog - cjdroute_control_pid=$( get_control_pid ) - - counter=0 - until kill -0 "$cjdroute_control_pid"; do - cjdroute_control_pid=$( get_control_pid ) - (( counter >= 5 )) && { - watchman.msg "cjdroute is down" - return 1 - } - (( counter++ )) - sleep 1 - done - - watchman.msg "cjdroute is running ($cjdroute_control_pid)" -} - -stop() { - [[ "$service_respawn" == 'true' ]] && { watchman.stop; } # stopping the watchdog - - # Stopping the actual s-o-b daemon that won't die properly. - cjdroute_control_pid=$( get_control_pid ) - watchman.pid_check "$cjdroute_control_pid" && { - kill "$cjdroute_control_pid" - watchman.pid_wait "$cjdroute_control_pid" - } +pre_start() { + cjdroute.check_tun_module } diff --git a/init.d/connmand b/init.d/connmand index 063d180..c7b01ec 100755 --- a/init.d/connmand +++ b/init.d/connmand @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm # Author: Alad Wenter depends dbus || return 1 diff --git a/init.d/cronie b/init.d/cronie new file mode 100755 index 0000000..0b1105d --- /dev/null +++ b/init.d/cronie @@ -0,0 +1,4 @@ +#!/usr/bin/env ssm + +service_command='/bin/crond' +service_args=( -n ) diff --git a/init.d/cupsd b/init.d/cupsd index 38062d8..80c7423 100755 --- a/init.d/cupsd +++ b/init.d/cupsd @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn='true' service_command='/usr/bin/cupsd' diff --git a/init.d/dbus b/init.d/dbus index 84acf9b..6cc9820 100755 --- a/init.d/dbus +++ b/init.d/dbus @@ -1,15 +1,10 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn=true service_command='/usr/bin/dbus-daemon' service_args=( --system --nofork ) service_tmpfiles=( '/run/dbus:dir' ) -start_pre() { +pre_start() { /usr/bin/dbus-uuidgen --ensure=/etc/machine-id } - -start() { - start_pre - watchman.start -} diff --git a/init.d/devfs-links b/init.d/devfs-links index 072dbfb..23a6256 100755 --- a/init.d/devfs-links +++ b/init.d/devfs-links @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm # This is a script to set up the links in /dev in absence of e?(u|s?m)dev. service_type='oneshot' diff --git a/init.d/dhcpcd b/init.d/dhcpcd index 1dacf4b..08d6ec5 100755 --- a/init.d/dhcpcd +++ b/init.d/dhcpcd @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm # dhcp client daemon initscript #service_respawn=true diff --git a/init.d/dnscrypt b/init.d/dnscrypt index c1f4066..12f4bc7 100755 --- a/init.d/dnscrypt +++ b/init.d/dnscrypt @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm # soft depend, OR return 1 for hard depend depends dnscrypt-backup diff --git a/init.d/dnscrypt-backup b/init.d/dnscrypt-backup index 62654f4..7efb0f6 100755 --- a/init.d/dnscrypt-backup +++ b/init.d/dnscrypt-backup @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn='true' service_command='/usr/bin/dnscrypt-proxy' diff --git a/init.d/docker b/init.d/docker index a607691..b0d70c7 100755 --- a/init.d/docker +++ b/init.d/docker @@ -1,15 +1,12 @@ -#!/usr/bin/env watchman - -docker_dir='/home/docker' +#!/usr/bin/env ssm #service_respawn='true' -service_command='/usr/bin/docker' -service_args=( -g "$docker_dir" -d ) +service_command=( '/usr/bin/dockerd' -s overlay2 ) update() { - watchman.stop && { + stop && { wget "https://get.docker.io/builds/Linux/x86_64/docker-latest" -O "$service_command" } - watchman.start + start } diff --git a/init.d/dropbear b/init.d/dropbear index 96268a2..ce95339 100755 --- a/init.d/dropbear +++ b/init.d/dropbear @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm service_respawn=true service_command='/usr/bin/dropbear' diff --git a/init.d/eudev b/init.d/eudev index 067a366..f2cc8d9 100755 --- a/init.d/eudev +++ b/init.d/eudev @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn='true' service_command='/usr/bin/udevd' @@ -6,12 +6,12 @@ service_command='/usr/bin/udevd' cfg_udev_settle_timeout="${cfg_udev_settle_timeout:-60}" udev.populate_dev() { - watchman.msg "Populating /dev with udev..." + printf 'Populating /dev with udev...\n' udevadm trigger --type=subsystems --action=add udevadm trigger --type=devices --action=add - watchman.msg "Waiting for uevents..." - udevadm settle --timeout=${cfg_udev_settle_timeout} + printf 'Waiting for uevents...\n' + udevadm settle "--timeout=${cfg_udev_settle_timeout}" udevadm control --property=do_not_run_plug_service= } diff --git a/init.d/fcgiwrap b/init.d/fcgiwrap index 484abd5..e8fe3d2 100755 --- a/init.d/fcgiwrap +++ b/init.d/fcgiwrap @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm # The configuration is in conf.d. #service_respawn='true' diff --git a/init.d/fsck b/init.d/fsck index 7bde37d..d1e83a5 100755 --- a/init.d/fsck +++ b/init.d/fsck @@ -1,14 +1,19 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm service_type='oneshot' +service_command=( /usr/bin/fsck -A -C -p ) + +pre_start() { + printf 'Remounting / as read-only...\n' + mount / -o remount,ro +} start() { - watchman.msg "Remounting / as read-only..." - mount / -o remount,ro + printf 'Checking filesystems...\n' + super_start +} - watchman.msg "Checking filesystems..." - /usr/bin/fsck -A -C -p - - watchman.msg "Remounting / as read-write..." +post_start() { + printf 'Remounting / as read-write...\n' mount / -o remount,rw } diff --git a/init.d/haproxy b/init.d/haproxy new file mode 100755 index 0000000..eaa32fd --- /dev/null +++ b/init.d/haproxy @@ -0,0 +1,5 @@ +#!/usr/bin/env ssm + +#service_respawn=true +service_command='/usr/bin/haproxy' +service_args=( -db -f /etc/haproxy/haproxy.cfg ) diff --git a/init.d/haveged b/init.d/haveged new file mode 100755 index 0000000..69586c3 --- /dev/null +++ b/init.d/haveged @@ -0,0 +1,4 @@ +#!/usr/bin/env ssm + +service_command=/usr/bin/haveged +service_args=( -F -w 1024 -v 1 ) diff --git a/init.d/hostname b/init.d/hostname index 7e993af..081370f 100644 --- a/init.d/hostname +++ b/init.d/hostname @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm # Get hostname from /etc/hostname if [[ -e "/etc/hostname" ]]; then diff --git a/init.d/hwdetect b/init.d/hwdetect index f230b70..f27ece8 100755 --- a/init.d/hwdetect +++ b/init.d/hwdetect @@ -1,15 +1,12 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm service_type='oneshot' +service_command=( /usr/bin/true ) -start() { - watchman.msg "Running module autodetect..." - watchman.start -} +pre_start() { + printf '(${service_name}) Running module autodetect...\n' -spawn() { - # The Alpine Linux hwdetect script runs this twice. - # Apparently to make sure we get devices that appear after loading a module on the first run. + # The Alpine Linux hwdetect script runs this twice. Apparently to make sure we get devices that appear after loading a module on the first run. find /sys -name modalias -type f -print0 | xargs -0 sort -u | xargs modprobe -b -a 2>/dev/null find /sys -name modalias -type f -print0 | xargs -0 sort -u | xargs modprobe -b -a 2>/dev/null diff --git a/init.d/iptables b/init.d/iptables index a4527be..e6659e8 100755 --- a/init.d/iptables +++ b/init.d/iptables @@ -1,13 +1,12 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm service_type='oneshot' - cfg_ip4dump='/etc/iptables/ip4.rules' cfg_ip6dump='/etc/iptables/ip6.rules' -spawn() { - watchman.msg "Restoring netfilter rules..." +service_command=( /usr/bin/true ) +start() { [[ -f "$cfg_ip4dump" ]] && { iptables-restore -t < "$cfg_ip4dump" || return 1 iptables-restore < "$cfg_ip4dump" @@ -17,20 +16,22 @@ spawn() { ip6tables-restore -t < "$cfg_ip6dump" || return 1 ip6tables-restore < "$cfg_ip6dump" } + + super_start } stop() { - watchman.msg "Flushing netfilter rules..." - iptables-save | sed -re 's/(:[A-Z]+\s+)[A-Z]+/\1ACCEPT/g' -e '/-.+/d' | iptables-restore ip6tables-save | sed -re 's/(:[A-Z]+\s+)[A-Z]+/\1ACCEPT/g' -e '/-.+/d' | ip6tables-restore for i in $(iptables-save | grep -E '^\*'); do iptables -t "${i//\*/}" -X; done for i in $(ip6tables-save | grep -E '^\*'); do ip6tables -t "${i//\*/}" -X; done + + super_stop } save() { - watchman.msg "Saving netfilter rules..." + printf 'Saving rules.\n' /usr/bin/iptables-save > "$cfg_ip4dump"; /usr/bin/ip6tables-save > "$cfg_ip6dump"; } diff --git a/init.d/isc-dhcpd b/init.d/isc-dhcpd index 2fd8c9e..3f8ae39 100755 --- a/init.d/isc-dhcpd +++ b/init.d/isc-dhcpd @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm # dhcp client daemon initscript #service_respawn=true diff --git a/init.d/kmscon b/init.d/kmscon index 16c73c9..f357ed6 100755 --- a/init.d/kmscon +++ b/init.d/kmscon @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm tty="${service_name##*-}" diff --git a/init.d/libvirtd b/init.d/libvirtd index 4223dc3..5820c76 100755 --- a/init.d/libvirtd +++ b/init.d/libvirtd @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn='true' service_command='/usr/bin/libvirtd' diff --git a/init.d/lo.iface b/init.d/lo.iface index 589c46d..ae5ea77 100755 --- a/init.d/lo.iface +++ b/init.d/lo.iface @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm cfg_iface="${service_name%%.*}" @@ -6,7 +6,7 @@ service_type='oneshot' service_command='/usr/bin/ip' service_args=( link set "$cfg_iface" up) -wait_for_iface() { +ready() { local iface="$1" timer='0' timeout='6' until [[ "$(ip link show $iface up)" ]]; do @@ -15,18 +15,7 @@ wait_for_iface() { done } -start() { - watchman.msg "Activating the $cfg_iface interface..." - watchman.start - - wait_for_iface || { - echo "Interface $cfg_iface failed to come up!" - return 1 - } -} - -stop() { - watchman.msg "Deactivating the $cfg_iface interface..." +pre_stop() { ip link set "${cfg_iface}" down - watchman.stop + super_stop } diff --git a/init.d/mariadb b/init.d/mariadb index 6ac9322..c415cf6 100755 --- a/init.d/mariadb +++ b/init.d/mariadb @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn='true' service_workdir='/usr' diff --git a/init.d/mdev b/init.d/mdev index caa469c..fcfe7eb 100755 --- a/init.d/mdev +++ b/init.d/mdev @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm service_type='oneshot' service_command='/usr/bin/mdev' diff --git a/init.d/memcached b/init.d/memcached index 20f284f..e3ba7e4 100755 --- a/init.d/memcached +++ b/init.d/memcached @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn=true service_command='/usr/bin/memcached' diff --git a/init.d/motd b/init.d/motd new file mode 100644 index 0000000..5d95842 --- /dev/null +++ b/init.d/motd @@ -0,0 +1,4 @@ +#!/usr/bin/env ssm + +service_type='oneshot' +service_command=( /usr/local/bin/update-motd ) diff --git a/init.d/mount b/init.d/mount index 6363c90..f6cac07 100755 --- a/init.d/mount +++ b/init.d/mount @@ -1,11 +1,12 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm service_type='oneshot' +service_command=( /usr/bin/mount -a ) -spawn() { +pre_start() { [[ -w / ]] || { mount -o remount,rw /; } - mount -a - swapon -a } -unset stop +post_start() { + swapon -a +} diff --git a/init.d/mpd b/init.d/mpd index e7923e3..a9f45ce 100755 --- a/init.d/mpd +++ b/init.d/mpd @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn=true service_command='/usr/bin/mpd' diff --git a/init.d/network b/init.d/network new file mode 100755 index 0000000..31f1003 --- /dev/null +++ b/init.d/network @@ -0,0 +1,10 @@ +#!/usr/bin/env ssm + +service_type='oneshot' +service_command=( /usr/bin/znet -d up ) + +ifaces=( 'eth0' 'warp' ) + +pre_stop() { + "$service_command" "${service_args[@]}" down +} diff --git a/init.d/ngetty b/init.d/ngetty index 3ad147e..9a36eed 100755 --- a/init.d/ngetty +++ b/init.d/ngetty @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm service_respawn='true' service_command='/usr/bin/ngetty' diff --git a/init.d/nginx b/init.d/nginx index 20d3773..886b587 100755 --- a/init.d/nginx +++ b/init.d/nginx @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm # For respawn to work, set 'daemon no' in nginx.conf #service_respawn='true' @@ -11,15 +11,12 @@ conftest() { nginx.test_config } -reload() { - if nginx.test_config -q; then - watchman.reload - else - watchman.err "Nginx config test failed, not reloading." - return 1 - fi +pre_reload() { + nginx.test_config || { + printf 'Config test failed, not reloading.\n' + } } upgrade() { - watchman.msg "This script has no zero-downtime upgrade support for nginx." + printf 'This script has no zero-downtime upgrade support for nginx.\n' } diff --git a/init.d/nrpe b/init.d/nrpe index 6279c18..79d90e8 100755 --- a/init.d/nrpe +++ b/init.d/nrpe @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm cfg_nrpe_config='/etc/nrpe/nrpe.cfg' diff --git a/init.d/ntp b/init.d/ntp index 9571d25..764207b 100755 --- a/init.d/ntp +++ b/init.d/ntp @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn='true' service_command='/usr/bin/ntpd' diff --git a/init.d/oidentd b/init.d/oidentd index 08237a2..c4cb16f 100755 --- a/init.d/oidentd +++ b/init.d/oidentd @@ -1,4 +1,4 @@ -#!/usr/bin/watchman +#!/usr/bin/env ssm service_command='/usr/bin/oidentd' service_args=( -i ) diff --git a/init.d/openntpd b/init.d/openntpd index 793a67a..ee0ef0d 100755 --- a/init.d/openntpd +++ b/init.d/openntpd @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn='true' service_command='/usr/bin/ntpd' diff --git a/init.d/openvpn b/init.d/openvpn index 79fc0ff..782f3f2 100755 --- a/init.d/openvpn +++ b/init.d/openvpn @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm cfg_ovpn_instance="${service_name##*-}" diff --git a/init.d/openvpn-server b/init.d/openvpn-server index 2ec2a59..7ff704e 100755 --- a/init.d/openvpn-server +++ b/init.d/openvpn-server @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm service_respawn='true' service_command="/usr/sbin/openvpn" diff --git a/init.d/pamusb b/init.d/pamusb index 2300747..e5edc0c 100755 --- a/init.d/pamusb +++ b/init.d/pamusb @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm service_type='oneshot' service_command='/usr/bin/mkdir' diff --git a/init.d/php-fpm b/init.d/php-fpm index 9abfdbe..58eae5e 100755 --- a/init.d/php-fpm +++ b/init.d/php-fpm @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn='true' service_command='/usr/bin/php-fpm' diff --git a/init.d/preload b/init.d/preload index 98ce9bb..3793d50 100755 --- a/init.d/preload +++ b/init.d/preload @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn='true' service_command='/usr/bin/preload' diff --git a/init.d/privoxy b/init.d/privoxy index 7b85641..24d9fc3 100755 --- a/init.d/privoxy +++ b/init.d/privoxy @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm privoxy_username='privoxy' privoxy_configfile='/etc/privoxy/config' @@ -7,16 +7,6 @@ privoxy_configfile='/etc/privoxy/config' service_command='/usr/bin/privoxy' service_args=( --no-daemon --user "$privoxy_username" "$privoxy_configfile" ) -privoxy::configtest() { +pre_restart() { "$service_command" --config-test "${service_args[@]}" } - -restart() { - privoxy::configtest || { - watchman.err "Config test failed, not restarting!" - return 1 - } - - watchman.stop - watchman.start -} diff --git a/init.d/prosody b/init.d/prosody index 67c9536..ba6fa01 100755 --- a/init.d/prosody +++ b/init.d/prosody @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm _prosodyctl='/usr/bin/prosodyctl' diff --git a/init.d/rc.local b/init.d/rc.local index 75d49b5..edb650d 100755 --- a/init.d/rc.local +++ b/init.d/rc.local @@ -1,12 +1,6 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm service_type='oneshot' service_command="/etc/rc.local" -unset stop - -start() { - [[ -f "/etc/rc.local" ]] && { - watchman.start - } -} +pre_start() [[ -f "/etc/rc.local" ]] diff --git a/init.d/rsyslogd b/init.d/rsyslogd index 96ce19a..f703659 100755 --- a/init.d/rsyslogd +++ b/init.d/rsyslogd @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm # Author: Alad Wenter #service_respawn=true diff --git a/init.d/scron b/init.d/scron index e91c088..52ff7f6 100755 --- a/init.d/scron +++ b/init.d/scron @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn='true' service_command='/usr/bin/crond' diff --git a/init.d/sdhcp b/init.d/sdhcp new file mode 100755 index 0000000..630c7c1 --- /dev/null +++ b/init.d/sdhcp @@ -0,0 +1,7 @@ +#!/usr/bin/env ssm +# dhcp client daemon initscript + +service_style='oneshot' +service_command='/usr/bin/sdhcp' + +stop() { killall sdhcp; } diff --git a/init.d/smdev b/init.d/smdev index af1af39..9a17c34 100755 --- a/init.d/smdev +++ b/init.d/smdev @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm service_type='oneshot' service_command='/usr/bin/smdev' diff --git a/init.d/sshd b/init.d/sshd index 8ce2cfd..fd28b87 100755 --- a/init.d/sshd +++ b/init.d/sshd @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm cfg_sshd_cfgdir='/etc/ssh' @@ -6,6 +6,10 @@ service_respawn=true service_command='/usr/bin/sshd' service_args=( -D -f "$cfg_sshd_cfgdir/sshd_config" ) +depends_ready=( znet ) + pre_start() { - [[ -e "/etc/ssh/ssh_host_key" ]] || { ssh-keygen -A; } + if ! [[ -e "/etc/ssh/ssh_host_key" ]]; then + ssh-keygen -A + fi } diff --git a/init.d/sysctl b/init.d/sysctl index 99bfa41..006c396 100755 --- a/init.d/sysctl +++ b/init.d/sysctl @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm unset reload service_type='oneshot' @@ -13,11 +13,3 @@ pre_start() { service_args=( -p "${sysctl_config_files[@]}" ) } - -start() { - if ! [[ "$sysctl_config_files" ]]; then - return 0 - fi - - watchman.start -} diff --git a/init.d/syslog-ng b/init.d/syslog-ng index bb0adaa..08fa1fb 100755 --- a/init.d/syslog-ng +++ b/init.d/syslog-ng @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn=true service_command='/usr/bin/syslog-ng' diff --git a/init.d/systemd-udevd b/init.d/systemd-udevd index 6305def..c9cb8b3 100755 --- a/init.d/systemd-udevd +++ b/init.d/systemd-udevd @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn='true' service_command='/usr/lib/systemd/systemd-udevd' @@ -6,11 +6,11 @@ service_command='/usr/lib/systemd/systemd-udevd' cfg_udev_settle_timeout="${cfg_udev_settle_timeout:-60}" udev.populate_dev() { - watchman.msg "Populating /dev with udev..." + prinft 'Populating /dev with udev...\n' udevadm trigger --type=subsystems --action=add udevadm trigger --type=devices --action=add - watchman.msg "Waiting for uevents..." + printf 'Waiting for uevents...\n' udevadm settle --timeout=${cfg_udev_settle_timeout} udevadm control --property=do_not_run_plug_service= } diff --git a/init.d/teamviewerd b/init.d/teamviewerd index 80f3808..2c0bb0a 100755 --- a/init.d/teamviewerd +++ b/init.d/teamviewerd @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn=true service_pidfile='/run/teamviewerd.pid' diff --git a/init.d/tinc b/init.d/tinc index 605b0d9..3f38236 100755 --- a/init.d/tinc +++ b/init.d/tinc @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm instance="${service_name##*-}" diff --git a/init.d/unbound b/init.d/unbound index a8a61e3..0d5ea6d 100755 --- a/init.d/unbound +++ b/init.d/unbound @@ -1,18 +1,11 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn='true' -service_command='/usr/bin/unbound' -service_args=( -d ) +service_command=( /usr/bin/unbound -d ) -conftest() { - unbound-checkconf -} - -reload() { - if conftest; then - watchman.reload - else - watchman.err "Configtest failed, not reloading." +pre_reload() { + unbound-checkconf || { + printf 'Configtest failed, not reloading.\n' return 1 - fi + } } diff --git a/init.d/userrc b/init.d/userrc new file mode 100755 index 0000000..346cd9e --- /dev/null +++ b/init.d/userrc @@ -0,0 +1,4 @@ +#!/usr/bin/env ssm + +service_type='oneshot' +service_command='/usr/bin/userrc' diff --git a/init.d/vdevd b/init.d/vdevd index 76459e5..8a60a5c 100755 --- a/init.d/vdevd +++ b/init.d/vdevd @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn='true' service_command='/usr/bin/vdevd' diff --git a/init.d/vixie-cron b/init.d/vixie-cron index 419fdd9..ca2495a 100755 --- a/init.d/vixie-cron +++ b/init.d/vixie-cron @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn='true' service_command='/usr/bin/crond' diff --git a/init.d/wpa_supplicant b/init.d/wpa_supplicant new file mode 100755 index 0000000..7d8e014 --- /dev/null +++ b/init.d/wpa_supplicant @@ -0,0 +1,5 @@ +#!/usr/bin/env ssm + +service_command='/usr/bin/wpa_supplicant' +service_config='/etc/wpa_supplicant/wpa_supplicant.conf' +service_args=( -i "${service_name##*-}" -c "$service_config" ) diff --git a/init.d/xinetd b/init.d/xinetd index ffcb34b..0b96e6b 100755 --- a/init.d/xinetd +++ b/init.d/xinetd @@ -1,4 +1,4 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm #service_respawn=true service_command='/usr/bin/xinetd' diff --git a/init.d/znet b/init.d/znet index 4b5f1bf..31f1003 100755 --- a/init.d/znet +++ b/init.d/znet @@ -1,10 +1,10 @@ -#!/usr/bin/env watchman +#!/usr/bin/env ssm service_type='oneshot' -service_command='/usr/bin/znet' -service_args=( -d ) +service_command=( /usr/bin/znet -d up ) -stop() { - "$service_command" $service_args down - watchman.stop +ifaces=( 'eth0' 'warp' ) + +pre_stop() { + "$service_command" "${service_args[@]}" down } diff --git a/init.d/zt b/init.d/zt new file mode 100644 index 0000000..43069ec --- /dev/null +++ b/init.d/zt @@ -0,0 +1,3 @@ +#!/usr/bin/env ssm + +service_command="/usr/bin/zerotier-one"