diff --git a/profiles/templates/taiga/check-crashed/.calculate_directory b/profiles/templates/taiga/check-crashed/.calculate_directory new file mode 100644 index 0000000..ae03782 --- /dev/null +++ b/profiles/templates/taiga/check-crashed/.calculate_directory @@ -0,0 +1 @@ +# Calculate env=install ac_install_merge==on mergepkg(www-servers/nginx)!= append=skip diff --git a/profiles/templates/taiga/check-crashed/check-crashed b/profiles/templates/taiga/check-crashed/check-crashed new file mode 100644 index 0000000..f01ec6e --- /dev/null +++ b/profiles/templates/taiga/check-crashed/check-crashed @@ -0,0 +1,18 @@ +# Calculate chmod=755 path=/usr/sbin +#!/bin/bash + +# Daemon restarts crashed services +# list the monitored services in /etc/conf.d/check-crashed +RC_MONITOR_RESTART=$@; + +while true; do + for svc in $(rc-status --crashed) ; do + for chk in $RC_MONITOR_RESTART ; do + if [ "$chk" = "$svc" ] ; then + rc-service $svc -- --nodeps restart + continue 2 + fi + done + done + sleep 1 +done diff --git a/profiles/templates/taiga/check-crashed/conf.check-crashed b/profiles/templates/taiga/check-crashed/conf.check-crashed new file mode 100644 index 0000000..345ddbb --- /dev/null +++ b/profiles/templates/taiga/check-crashed/conf.check-crashed @@ -0,0 +1,2 @@ +# Calculate format=openrc path=/etc/conf.d name=#-cut(1,.)-# protected +RC_MONITOR_RESTART="taiga taiga-async taiga-events taiga-protected" diff --git a/profiles/templates/taiga/check-crashed/init.check-crashed b/profiles/templates/taiga/check-crashed/init.check-crashed new file mode 100644 index 0000000..bd9c072 --- /dev/null +++ b/profiles/templates/taiga/check-crashed/init.check-crashed @@ -0,0 +1,11 @@ +# Calculate path=/etc/init.d name=#-cut(1,.)-# chmod=755 comment=# protected +#!/sbin/openrc-run + +pidfile="/run/check_crashed.pid" +command="/usr/sbin/check-crashed" +command_args="${RC_MONITOR_RESTART}" +command_background=1 + +depend() { + need taiga +} diff --git a/profiles/templates/taiga/check-crashed/runlevel.check-crashed b/profiles/templates/taiga/check-crashed/runlevel.check-crashed new file mode 100644 index 0000000..d96c623 --- /dev/null +++ b/profiles/templates/taiga/check-crashed/runlevel.check-crashed @@ -0,0 +1 @@ +# Calculate path=/etc/runlevels/default name=#-cut(1,.)-# link=/etc/init.d/#-cut(1,.)-# protected symbolic diff --git a/scripts/cl-setup-taiga.sh b/scripts/cl-setup-taiga.sh index a39247c..58facf6 100755 --- a/scripts/cl-setup-taiga.sh +++ b/scripts/cl-setup-taiga.sh @@ -25,8 +25,8 @@ if [[ ! -e /etc/runlevels/default/taiga ]] then rc-update add taiga rc-update -u - openrc fi +openrc if [[ -z $show ]] then