Univention Bugzilla – Attachment 9745 Details for
Bug 41262
Include univention-replicate-many into notifier package
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
improved script
univention-replicate-many (text/plain), 3.84 KB, created by
Jannik Ahlers
on 2018-11-15 11:28:37 CET
(
hide
)
Description:
improved script
Filename:
MIME Type:
Creator:
Jannik Ahlers
Created:
2018-11-15 11:28:37 CET
Size:
3.84 KB
patch
obsolete
>#!/bin/bash -e ># ># Univention Directory Notifier ># Replicate many DN ># ># Copyright 2012-2016 Univention GmbH ># ># http://www.univention.de/ ># ># All rights reserved. ># ># The source code of this program is made available ># under the terms of the GNU Affero General Public License version 3 ># (GNU AGPL V3) as published by the Free Software Foundation. ># ># Binary versions of this program provided by Univention to you as ># well as other copyrighted, protected or trademarked materials like ># Logos, graphics, fonts, specific documentations and configurations, ># cryptographic keys etc. are subject to a license agreement between ># you and Univention and not subject to the GNU AGPL V3. ># ># In the case you use this program under the terms of the GNU AGPL V3, ># the program is provided in the hope that it will be useful, ># but WITHOUT ANY WARRANTY; without even the implied warranty of ># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ># GNU Affero General Public License for more details. ># ># You should have received a copy of the GNU Affero General Public ># License with the Debian GNU/Linux or Univention distribution in file ># /usr/share/common-licenses/AGPL-3; if not, see ># <http://www.gnu.org/licenses/>. > >eval "$(ucr shell)" > >usage() >{ > echo "Usage: $0 --dn-file <file name>" > echo > echo "The DNs in the given file will be re-replicated by the Univention Directory Notifier to all UCS systems in this UCS domain. This tool must be run on the domain controller master." > echo > echo "Warning: This tool will stop the OpenLDAP and the Notifier daemon." > echo >} > >if [ "$server_role" != "domaincontroller_master" ]; then > echo "Abort: This tool must be run on the domain controller Master!" >&2 > exit 1 >fi > >if [ ! -e /var/lib/univention-ldap/notify/transaction ]; then > echo "Abort: /var/lib/univention-ldap/notify/transaction was not found." >&2 > exit 1 >fi > >if [ "$#" != 2 ] || [ "$1" != "--dn-file" ]; then > usage >&2 > exit 1 >fi > >dnfile="$2" > >if [ ! -r "${dnfile}" ]; then > echo "${dnfile} is not readable" >&2 > exit 1 >fi > >RESTART_NOTIFIER=0 >if pidof univention-directory-notifier >/dev/null ; then > echo -n "Stopping notifier: " > RESTART_NOTIFIER=1 > /etc/init.d/univention-directory-notifier stop >/dev/null > sleep 1 > if pidof univention-directory-notifier >/dev/null ; then > echo "failed" > echo "Abort: Failed to stop the notifier daemon. Please check stop the daemon manually and try again." >&2 > exit 1 > fi > echo "done" >fi > >RESTART_SLAPD=0 >if pidof slapd >/dev/null ; then > echo -n "Stopping slapd: " > RESTART_SLAPD=1 > /etc/init.d/slapd stop >/dev/null > sleep 1 > if pidof slapd >/dev/null ; then > echo "failed" > echo "Abort: Failed to stop the OpenLDAP daemon. Please check stop the daemon manually and try again." >&2 > exit 1 > fi > echo "done" >fi > > > >echo -n "Write $(wc -l "${dnfile}" | awk '{print $1}') DNs to listener file: " >id="$(tail -n 1 /var/lib/univention-ldap/notify/transaction | awk '{print $1}')" > >last_line="$(tail -n 1 /var/lib/univention-ldap/listener/listener)" >if [ -n "$last_line" ]; then > id_listener="$(tail -n 1 /var/lib/univention-ldap/listener/listener | awk '{print $1}')" >fi > >if [ -n "$id_listener" ] && [ "$id_listener" -gt "$id" ]; then > nextid=$((id_listener+1)) >else > nextid=$((id+1)) >fi > >skip= >while read -r dn; do > if [ -n "$dn" ] && slapdn "$dn" > /dev/null 2>&1; then > echo "$nextid $dn m" >>/var/lib/univention-ldap/listener/listener > echo -n "$nextid" >/var/lib/univention-ldap/last_id > nextid=$((nextid+1)) > else > # shellcheck disable=SC2206,SC1117 > test -n "$dn" && skip=($skip"Info: Skipped invalid dn $dn\n") > fi >done < "${dnfile}" >echo "done" >echo -ne "${skip[*]}" >rc=0 > >if [ "$RESTART_NOTIFIER" = 1 ]; then > echo -n "Starting notifier: " > /etc/init.d/univention-directory-notifier start >/dev/null || rc=1 > echo "done" >fi > >if [ "$RESTART_SLAPD" = 1 ]; then > echo -n "Starting slapd: " > /etc/init.d/slapd start >/dev/null || rc=1 > echo "done" >fi > >exit $rc
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 41262
:
7655
| 9745 |
9827
|
9828