good morning everyone,
if the environment is big, hooking all stores to the right user is quite time consuming…
for hooking multiple guessed store to the user, i wrote a script little in the past:
requirement: use an ldapsearch to get all users with attribute kopano and write just the username to a file
now you should have a list with all users in ldap which should use kopano. i call it username.txt in /tmp/
kopano-admin --list-orphans | grep private > /tmp/stores.txt
for e in $(cat /tmp/username.txt); do
userline=""
user_store=""
echo "searching store for $e"
userline=$(cat /tmp/stores.txt | grep $e)
if [ "x$userline" = "x" ]; then
echo "user $e not found"
continue
else
echo "user $e found"
user_store=$(echo $userline |awk -F" " '{print $1}')
if [ "x$user_store" != "x" ]; then
kopano-admin --hook-store $user_store $e
if [ $? = 0 ]; then
echo "successfully hooked $user_store to user:$e"
else
echo "FEHLER $user_store not hooked to $e"
fi
fi
fi
done
for testing, just change the ‘kopano-admin --hook-store’ command in a ‘echo “kopano-admin --hook-store […]”’ you will get the commands
regards
coffee_is_life