View | Details | Raw Unified | Return to bug 41262 | Differences between
and this patch

Collapse All | Expand All

(-)a/management/univention-directory-notifier/univention-replicate-many (-15 / +23 lines)
Lines 68-74 RESTART_NOTIFIER=0 Link Here
68
if pidof univention-directory-notifier >/dev/null ; then
68
if pidof univention-directory-notifier >/dev/null ; then
69
	echo -n "Stopping notifier: "
69
	echo -n "Stopping notifier: "
70
	RESTART_NOTIFIER=1
70
	RESTART_NOTIFIER=1
71
	/etc/init.d/univention-directory-notifier stop >/dev/null
71
	systemctl stop univention-directory-notifier
72
	sleep 1
72
	sleep 1
73
	if pidof univention-directory-notifier >/dev/null ; then
73
	if pidof univention-directory-notifier >/dev/null ; then
74
		echo "failed"
74
		echo "failed"
Lines 82-88 RESTART_SLAPD=0 Link Here
82
if pidof slapd >/dev/null ; then
82
if pidof slapd >/dev/null ; then
83
	echo -n "Stopping slapd: "
83
	echo -n "Stopping slapd: "
84
	RESTART_SLAPD=1
84
	RESTART_SLAPD=1
85
	/etc/init.d/slapd stop >/dev/null
85
	systemctl stop slapd
86
	sleep 1
86
	sleep 1
87
	if pidof slapd >/dev/null ; then
87
	if pidof slapd >/dev/null ; then
88
		echo "failed"
88
		echo "failed"
Lines 97-103 id="$(tail -n 1 /var/lib/univention-ldap/notify/transaction | awk '{print $1}')" Link Here
97
97
98
last_line="$(tail -n 1 /var/lib/univention-ldap/listener/listener)"
98
last_line="$(tail -n 1 /var/lib/univention-ldap/listener/listener)"
99
if [ -n "$last_line" ]; then
99
if [ -n "$last_line" ]; then
100
	id_listener="$(tail -n 1 /var/lib/univention-ldap/listener/listener | awk '{print $1}')"
100
	id_listener="$(awk '{print $1}' <<<"$last_line")"
101
fi
101
fi
102
102
103
if [ -n "$id_listener" ] && [ "$id_listener" -gt "$id" ]; then
103
if [ -n "$id_listener" ] && [ "$id_listener" -gt "$id" ]; then
Lines 106-136 else Link Here
106
	nextid=$((id+1))
106
	nextid=$((id+1))
107
fi
107
fi
108
108
109
skip=
109
skip=''
110
while read -r dn; do
110
while read -r dn; do
111
	if [ -n "$dn" ] && slapdn "$dn" > /dev/null 2>&1; then
111
	if [ -n "$dn" ] && slapdn "$dn" > /dev/null 2>&1; then
112
		echo "$nextid $dn m" >>/var/lib/univention-ldap/listener/listener
112
		echo "$nextid $dn m" >>/var/lib/univention-ldap/listener/listener
113
		echo -n "$nextid" >/var/lib/univention-ldap/last_id
113
		echo -n "$nextid" >/var/lib/univention-ldap/last_id
114
		nextid=$((nextid+1))
114
		nextid=$((nextid+1))
115
	else
115
	else
116
		# shellcheck disable=SC2206,SC1117
116
		# shellcheck disable=SC1117
117
		test -n "$dn" && skip=($skip"Info: Skipped invalid dn '$dn'\n")
117
		test -n "$dn" && skip="${skip}Info: Skipped invalid dn '$dn'\n"
118
	fi
118
	fi
119
done < "${dnfile}"
119
done < "${dnfile}"
120
echo "done"
120
echo "done"
121
echo -ne "${skip[*]}" >&2
121
echo -ne "$skip" >&2
122
122
rc=0
123
rc=0
124
if [ "$RESTART_SLAPD" = 1 ]; then
125
	echo -n "Starting slapd: "
126
	if systemctl start slapd; then
127
		echo "done"
128
	else
129
		echo "failed"
130
		rc=1
131
	fi
132
fi
123
133
124
if [ "$RESTART_NOTIFIER" = 1 ]; then
134
if [ "$RESTART_NOTIFIER" = 1 ]; then
125
	echo -n "Starting notifier: "
135
	echo -n "Starting notifier: "
126
	/etc/init.d/univention-directory-notifier start >/dev/null || rc=1
136
	if systemctl start univention-directory-notifier; then
127
	echo "done"
137
		echo "done"
128
fi
138
	else
129
139
		echo "failed"
130
if [ "$RESTART_SLAPD" = 1 ]; then
140
		rc=1
131
	echo -n "Starting slapd: "
141
	fi
132
	/etc/init.d/slapd start >/dev/null || rc=1
133
	echo "done"
134
fi
142
fi
135
143
136
exit $rc
144
exit $rc

Return to bug 41262