View | Details | Raw Unified | Return to bug 22605
Collapse All | Expand All

(-)ucs/virtualization/univention-virtual-machine-manager-daemon/uvmmd-check.sh (-11 / +9 lines)
 Lines 30-58    Link Here 
30
# /usr/share/common-licenses/AGPL-3; if not, see
30
# /usr/share/common-licenses/AGPL-3; if not, see
31
# <http://www.gnu.org/licenses/>.
31
# <http://www.gnu.org/licenses/>.
32
32
33
eval "$(ucr shell uvmm/check/timeout)"
34
35
logfile="/var/log/univention/virtual-machine-manager-daemon-errors.log"
33
logfile="/var/log/univention/virtual-machine-manager-daemon-errors.log"
36
tempfile="$(mktemp)"
37
34
38
if sv status /etc/runit/univention-virtual-machine-manager-daemon | grep ^run: > /dev/null 2>&1; then
35
if sv status /etc/runit/univention-virtual-machine-manager-daemon | grep ^run: > /dev/null 2>&1; then
36
	tempfile="$(mktemp)"
37
	trap "rm -f '$tempfile'" EXIT
38
39
	uvmm groups >"$tempfile" 2>&1 &
39
	uvmm groups >"$tempfile" 2>&1 &
40
	pid=$!
40
41
41
	timeout=${uvmm_check_timeout:-5}
42
	eval "$(univention-config-registry shell uvmm/check/timeout)"
42
	sleep ${timeout}s
43
	sleep ${uvmm_check_timeout:-5}s
43
44
44
	grep -q "^DATA:" "$tempfile"
45
	if ! grep -q "^DATA:" "$tempfile"
45
	if [ "$?" != 0 ]; then
46
	then
46
		# Kill the uvmm process
47
		# Kill the uvmm process
47
		pkill -P $$ uvmm
48
		kill $pid
48
49
49
		echo "uvmm-check.sh: uvmm does not response like expected. Restarting uvmmd now." >>"$logfile"
50
		echo "uvmm-check.sh: uvmm does not response like expected. Restarting uvmmd now." >>"$logfile"
50
		cat "$tempfile" >> "$logfile"
51
		cat "$tempfile" >> "$logfile"
51
		invoke-rc.d univention-virtual-machine-manager-daemon restart
52
		invoke-rc.d univention-virtual-machine-manager-daemon restart
52
	fi
53
	fi
53
54
	rm "$tempfile"
55
56
fi
54
fi
57
55
58
exit 0
56
exit 0

Return to bug 22605