View Single Post
  #10 (permalink)  
Old 09-04-2008, 08:29 PM
alexkelly alexkelly is offline
Trained Alumni
 
Posts: 54
Default

I have been using the following script to create a calendar hierarchy of "others" calendars, so you will get /Others/group/user1, /Others/group/user2, etc. Perhaps it will help.
Code:
#!/bin/bash
domain="yourdomain.com"
GROUPFILE="groupfile"
USERFILE="userstoadd"
for x in `cat $GROUPFILE`
do
	GRP=`echo $x|cut -d: -f1`
	USR=`echo $x|cut -d: -f2`
	echo "sm $USR"
	for y in `cat $USERFILE`
	do
		echo "mfg /Calendar account $y@$domain rwidx"
	done
done

for a in `cat $USERFILE`
do
	echo "sm $a"
	echo "cf -V appointment /Others"
	for b in `cat $GROUPFILE`
	do
		GRP=`echo $b|cut -d: -f1`
		COL=`echo $b|cut -d: -f3`
		echo "cf -c $COL -V appointment /Others/$GRP"
	done
	for c in `cat $GROUPFILE`
	do
		GRP=`echo $c|cut -d: -f1`
	        USR=`echo $c|cut -d: -f2`
		COL=`echo $c|cut -d: -f3`
		echo "cm -c $COL -V appointment /Others/$GRP/$USR $USR@$domain /Calendar"
	done
done
The file that gets in $USERFILE is simply a list of usernames to which you wish to create the "others" calendar group. The $GROUPFILE is a colon-delimited file that looks like
Code:
username:groupheading:color
So if you had "bob:accounting:red", you would get an /Others/accounting/bob calendar that was shared from bob@domain.com.

When you run the script, it is best to redirect the output to a file, and then:
Code:
zmmailbox -z < redirectedfile
This was a hack I threw together one weekend to accomplish a mass calendar sharing hierarchy that needed setup in our environment. It has worked for me, but it sort of a pain to maintain, if someone gets added to the calendar or someone changes departments. I have another script that is basically the same as this with the addition of a "rf /others" at the beginning so it goes through and just removes the "other" and then create the whole hierarchy over again.
Reply With Quote