I just started evaluating zimbra yesterday and have been fiddling with it for a few hours.

Could not find a finished script for mounting a Shared users Calendar into a group of folders, so i made on this night. Thought my first post could be a little contribution

This script will also set permissions for the group to access the mounted folder.


# Variables     Set the variabels for the script

DISTGROUP=usergroup@domain.net			#Distrubution group
SHAREUSER=shared@user.net		#Sharing User
USERFOLDER="Vacation Calendar"					#Name of the users new mounted Folder
SHAREFOLDER="SharedVacCal"					#Name of the Shared Folder on the shared user (ex Calendar or "Vacation Calandar"
Perm=r							#Permissions to set ex: r, rw, rwix, rwixd, rwixda, none

# Setting permissions on folder

echo "Setting Permissions..."

zmmailbox -z -m $SHAREUSER mfg /"$SHAREFOLDER" account $DISTGROUP r

echo "Done..."

# Mounting Folder

nTot=`zmprov gdl $DISTGROUP | grep ForwardingAddress: | awk '{FS = " "} ; {print $2}' | wc | awk '{FS = tab} ; {print $2}'`

echo "Mounting shares, could take a long time"

for USERS in `zmprov gdl $DISTGROUP | grep ForwardingAddress: | awk '{FS = " "} ; {print $2}'`

  echo "Mounting '$SHAREFOLDER' -> '$USERFOLDER' for  '$USERS'    ($n/$nTot)"
  zmmailbox -z -m $USERS cm --view appointment -F# /"$USERFOLDER" $SHAREUSER /"$SHAREFOLDER"
  let "n++"



echo "Finished"
As Iíve understand the zmmailbox command you should be able to use this to mount other folders as a mail or task folder also.
Note This takes quite some time to run if it's a lot of users in the distribution group, it takes more than a second per user on my virtual test debian server with quite low specs.

If someone would decide to improve this script, a good one would be to first make a check on which of the users already have the folder mounted and skip them from the $USERS variable. That is something I dont know how to do.

If this was done, you could easely run this script again after adding some users to a distrobution group. It is ofcourse possible even now, but you will get a error message from all users already having a folder with the name specified. And it will take a long time to ad the folder to some new users if alot of users already have this folder mounted.

another improvement should be to be to make you able to cancel the operation, if you misstype anything and the folders does not exist, it will try and fail at everyone. You can't cancel and fix the topy. You'l have to whait for it to complete first.