Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
2017-12-10 20:44:17 +03:00
parent e6f85aa437
commit d85b1945e9
115 changed files with 132 additions and 238 deletions
+3
View File
@@ -0,0 +1,3 @@
Here lie the service scripts in all their glory.
Please be advised that the scripts may need tweaking to work on different systems.
These were written for my Arch desktops so should all work for most arch boxes out there.
Executable
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
service_respawn='true'
service_command=( /usr/bin/acpid -f )
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
service_respawn='true'
service_command=( /usr/bin/agetty 38400 "${service_name##*-}" linux )
+1
View File
@@ -0,0 +1 @@
agetty
+1
View File
@@ -0,0 +1 @@
agetty
+1
View File
@@ -0,0 +1 @@
agetty
+1
View File
@@ -0,0 +1 @@
agetty
+1
View File
@@ -0,0 +1 @@
agetty
+1
View File
@@ -0,0 +1 @@
agetty
Executable
+8
View File
@@ -0,0 +1,8 @@
#!/usr/bin/env ssm
#service_respawn='true'
service_command=( /usr/bin/alsactl rdaemon )
stop() {
"$service_command" kill save_and_quit
}
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
service_respawn=true
service_command=( /usr/bin/atd -f )
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env ssm
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
}
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env ssm
# This script is intended for Daemon mode.
# Modify it for your setup.
#service_respawn=true
service_command=( /usr/bin/bitlbee -n )
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env ssm
service_command='/usr/bin/cgmanager'
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env ssm
service_command=( /usr/bin/chef-client -i 600 -s 3 -l info )
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
#service_respawn='true'
service_command=( /usr/bin/chronyd -u chrony )
+28
View File
@@ -0,0 +1,28 @@
#!/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
# 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_command='/usr/bin/run-cjdroute'
cjdroute_admin_port='11234'
cjdroute.check_tun_module() {
[[ -e '/dev/net/tun' ]] || {
modprobe tun || {
printf 'Could not load module tun!\n'
return 1
}
}
}
pre_start() {
cjdroute.check_tun_module
}
+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env ssm
# Author: Alad Wenter
service_depends=( dbus )
service_command=( /usr/bin/connmand -n )
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env ssm
service_command=( /bin/crond -n )
Executable
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
#service_respawn='true'
service_command=( /usr/bin/cupsd -f )
Executable
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env ssm
#service_respawn=true
service_command=( /usr/bin/dbus-daemon --system --nofork )
service_tmpfiles=( '/run/dbus:dir' )
pre_start() {
/usr/bin/dbus-uuidgen --ensure=/etc/machine-id
}
+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env ssm
# dhcp client daemon initscript
#service_respawn=true
service_command=( /usr/bin/dhcpcd -B )
+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/env ssm
# soft depend, OR return 1 for hard depend
depends dnscrypt-backup
#service_respawn='true'
service_command=(
'/usr/bin/dnscrypt-proxy'
"--local-address=${local_ip}:${local_port}"
"--resolver-address=${resolver_ip}:${resolver_port}"
"--provider-name=${provider_name}"
"--provider-key=${provider_key}"
"--user=${local_user}"
)
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env ssm
#service_respawn='true'
service_command=(
'/usr/bin/dnscrypt-proxy'
"--local-address=${local_ip}:${local_port}"
"--resolver-address=${resolver_ip}:${resolver_port}"
"--provider-name=${provider_name}"
"--provider-key=${provider_key}"
"--user=${local_user}"
)
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env ssm
#service_respawn='true'
service_command=( '/usr/bin/dockerd' -s overlay2 )
update() {
stop && {
wget "https://get.docker.io/builds/Linux/x86_64/docker-latest" -O "$service_command"
}
start
}
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
service_respawn=true
service_command='/usr/bin/dropbear'
+1
View File
@@ -0,0 +1 @@
lo.iface
Executable
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env ssm
#service_respawn='true'
service_command='/usr/bin/udevd'
cfg_udev_settle_timeout="${cfg_udev_settle_timeout:-60}"
udev.populate_dev() {
printf 'Populating /dev with udev...\n'
udevadm trigger --type=subsystems --action=add
udevadm trigger --type=devices --action=add
printf 'Waiting for uevents...\n'
udevadm settle "--timeout=${cfg_udev_settle_timeout}"
udevadm control --property=do_not_run_plug_service=
}
post_start() { sleep 1; udev.populate_dev; }
reload() {
udevadm control --reload
}
+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env ssm
# The configuration is in conf.d.
#service_respawn='true'
service_command=( /usr/bin/spawn-fcgi -s "$cfg_socket" -P "$service_pidfile" -u "$cfg_user" -g "$cfg_group" -- /usr/bin/fcgiwrap )
Executable
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env ssm
service_type='oneshot'
service_command=( /usr/bin/ferm /etc/ferm.conf )
reload() { "${service_command[@]}"; }
Executable
+19
View File
@@ -0,0 +1,19 @@
#!/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() {
printf 'Checking filesystems...\n'
super_start
}
post_start() {
printf 'Remounting / as read-write...\n'
mount / -o remount,rw
}
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
#service_respawn=true
service_command=( /usr/bin/haproxy -db -f /etc/haproxy/haproxy.cfg )
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env ssm
service_command=( /usr/bin/haveged -F -w 1024 -v 1 )
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env ssm
# Get hostname from /etc/hostname
if [[ -e "/etc/hostname" ]]; then
cfg_hostname="$(</etc/hostname)"
fi
[[ "$cfg_hostname" ]] || { cfg_hostname='localhost'; }
service_type='oneshot'
service_command=( /usr/bin/hostname "$cfg_hostname" )
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env ssm
service_type='oneshot'
service_command=( /usr/bin/true )
pre_start() {
printf '(${service_name}) Running module autodetect...\n'
# 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
# This script cannot be regarded as failed. It has no definitive failure state.
return 0
}
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env ssm
service_type='oneshot'
cfg_ip4dump='/etc/iptables/ip4.rules'
cfg_ip6dump='/etc/iptables/ip6.rules'
service_command=( /usr/bin/true )
start() {
[[ -f "$cfg_ip4dump" ]] && {
iptables-restore -t < "$cfg_ip4dump" || return 1
iptables-restore < "$cfg_ip4dump"
}
[[ -f "$cfg_ip6dump" ]] && {
ip6tables-restore -t < "$cfg_ip6dump" || return 1
ip6tables-restore < "$cfg_ip6dump"
}
super_start
}
stop() {
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() {
printf 'Saving rules.\n'
/usr/bin/iptables-save > "$cfg_ip4dump";
/usr/bin/ip6tables-save > "$cfg_ip6dump";
}
+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env ssm
# dhcp client daemon initscript
#service_respawn=true
service_command=( /usr/sbin/dhcpd -f )
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env ssm
tty="${service_name##*-}"
service_respawn='true'
service_command=(
'/usr/bin/kmscon'
--vt "$tty"
--hwaccel --drm
--font-name "$kmscon_font_name"
--palette "$kmscon_palette"
)
+1
View File
@@ -0,0 +1 @@
kmscon
+1
View File
@@ -0,0 +1 @@
kmscon
+1
View File
@@ -0,0 +1 @@
kmscon
+1
View File
@@ -0,0 +1 @@
kmscon
+1
View File
@@ -0,0 +1 @@
kmscon
+1
View File
@@ -0,0 +1 @@
kmscon
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
#service_respawn='true'
service_command='/usr/bin/libvirtd'
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env ssm
cfg_iface="${service_name%%.*}"
service_type='oneshot'
service_command=( /usr/bin/ip link set "$cfg_iface" up )
ready() {
local iface="$1" timer='0' timeout='6'
until [[ "$(ip link show $iface up)" ]]; do
(( timer >= timeout )) && { return 1; }
(( timer++ ))
done
}
pre_stop() {
ip link set "${cfg_iface}" down
super_stop
}
+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env ssm
#service_respawn='true'
service_workdir='/usr'
service_command=( /usr/bin/mysqld_safe --datadir=/var/lib/mysql )
Executable
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env ssm
service_type='oneshot'
service_command=( /usr/bin/mdev -s )
post_start() {
echo "Enabling hotplug..."
echo /bin/mdev > /proc/sys/kernel/hotplug
}
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env ssm
service_command=( /usr/bin/memcached -m 64 -p 11211 -u nobody -l 127.0.0.1 )
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
service_type='oneshot'
service_command=( /usr/local/bin/update-motd )
Executable
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env ssm
service_type='oneshot'
service_command=( /usr/bin/mount -a )
pre_start() {
[[ -w / ]] || { mount -o remount,rw /; }
}
post_start() {
swapon -a
}
Executable
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
#service_respawn=true
service_command=( /usr/bin/mpd --no-daemon )
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
service_respawn='true'
service_command='/usr/bin/ngetty'
Executable
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env ssm
# For respawn to work, set 'daemon no' in nginx.conf
#service_respawn='true'
service_command='/usr/bin/nginx'
service_pidfile='/run/nginx.pid'
nginx.test_config() { "$service_command" -t "$@"; }
conftest() {
nginx.test_config
}
pre_reload() {
nginx.test_config || {
printf 'Config test failed, not reloading.\n'
}
}
upgrade() {
printf 'This script has no zero-downtime upgrade support for nginx.\n'
}
Executable
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/env ssm
cfg_nrpe_config='/etc/nrpe/nrpe.cfg'
#service_respawn=true
service_command=( /usr/bin/nrpe -c "$cfg_nrpe_config" -d )
service_pidfile='/run/nrpe.pid'
Executable
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env ssm
service_command=( /usr/bin/ntpd -n )
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env ssm
service_command=( /usr/bin/oidentd -i )
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env ssm
service_command=( /usr/bin/ntpd -d )
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/env ssm
cfg_ovpn_instance="${service_name##*-}"
service_respawn='true'
service_command=( /usr/bin/openvpn client.cfg )
service_workdir="/etc/openvpn/$cfg_ovpn_instance"
+1
View File
@@ -0,0 +1 @@
openvpn
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
service_workdir="/etc/openvpn"
service_command=( /usr/sbin/openvpn server.conf )
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
service_type='oneshot'
service_command=( /usr/bin/mkdir -p /run/lock )
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env ssm
service_command=( /usr/bin/php-fpm -F --fpm-config /etc/php/php-fpm.conf -c /etc/php/php.ini )
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
#service_respawn='true'
service_command=( /usr/bin/preload -f )
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env ssm
privoxy_username='privoxy'
privoxy_configfile='/etc/privoxy/config'
service_command=( /usr/bin/privoxy --no-daemon --user "$privoxy_username" "$privoxy_configfile" )
pre_restart() {
"$service_command" --config-test "$privoxy_configfile"
}
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env ssm
_prosodyctl='/usr/bin/prosodyctl'
start() { "$_prosodyctl" start; }
stop() { "$_prosodyctl" stop; }
restart() { "$_prosodyctl" restart; }
reload() { "$_prosodyctl" reload; }
status() { "$_prosodyctl" status; }
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env ssm
service_type='oneshot'
service_command="/etc/rc.local"
pre_start() [[ -f "/etc/rc.local" ]]
+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env ssm
# Author: Alad Wenter
#service_respawn=true
service_command=( /usr/bin/rsyslogd -n )
Executable
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
#service_respawn='true'
service_command=( /usr/bin/crond -n )
Executable
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/env ssm
# dhcp client daemon initscript
service_style='oneshot'
service_command='/usr/bin/sdhcp'
stop() { killall sdhcp; }
Executable
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env ssm
service_type='oneshot'
service_command=( /usr/bin/smdev -s )
post_start() {
echo "Enabling hotplug..."
echo /bin/smdev > /proc/sys/kernel/hotplug
}
Executable
+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/env ssm
cfg_sshd_cfgdir='/etc/ssh'
service_respawn=true
service_command=( /usr/bin/sshd -D -f "$cfg_sshd_cfgdir/sshd_config" )
depends_ready=( znet )
pre_start() {
if ! [[ -e "/etc/ssh/ssh_host_key" ]]; then
ssh-keygen -A
fi
}
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env ssm
unset reload
service_type='oneshot'
service_command='/usr/bin/sysctl'
pre_start() {
for i in /etc/sysctl.conf /etc/sysctl.d/* /usr/lib/sysctl.d/*; do
[[ -f "$i" ]] && {
sysctl_config_files+=( "$i" )
}
done
service_command+=( -p "${sysctl_config_files[@]}" )
}
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
#service_respawn=true
service_command=( /usr/bin/syslog-ng -F )
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env ssm
#service_respawn='true'
service_command='/usr/lib/systemd/systemd-udevd'
cfg_udev_settle_timeout="${cfg_udev_settle_timeout:-60}"
udev.populate_dev() {
prinft 'Populating /dev with udev...\n'
udevadm trigger --type=subsystems --action=add
udevadm trigger --type=devices --action=add
printf 'Waiting for uevents...\n'
udevadm settle --timeout=${cfg_udev_settle_timeout}
udevadm control --property=do_not_run_plug_service=
}
post_start() { sleep 1; udev.populate_dev; }
reload() {
udevadm control --reload
}
Executable
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env ssm
instance="${service_name##*-}"
service_respawn='true'
service_command=( /usr/bin/tincd -D -n "$instance" )
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env ssm
#service_respawn='true'
service_command=( /usr/bin/unbound -d )
pre_reload() {
unbound-checkconf || {
printf 'Configtest failed, not reloading.\n'
return 1
}
}
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
service_type='oneshot'
service_command='/usr/bin/userrc'
Executable
+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/env ssm
#service_respawn='true'
service_command=( /usr/bin/vdevd -f /dev )
service_tmpfiles=( '/run/vdev:dir' '/run/udev:symlink:/dev/metadata/udev' )
pre_start() {
# Ensure that hotplug is empty
if [[ -f /proc/sys/kernel/hotplug ]]; then
true > /proc/sys/kernel/hotplug
fi
"$service_command" -1 -f /dev &>"$service_logfile"
}
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
#service_respawn='true'
service_command=( /usr/bin/crond -f )
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env ssm
service_config='/etc/wpa_supplicant/wpa_supplicant.conf'
service_command=( /usr/bin/wpa_supplicant -i "${service_name##*-}" -c "$service_config" )
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env ssm
service_command=( /usr/bin/xinetd -dontfork )
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env ssm
service_command="/usr/bin/zerotier-one"