Migration user via csexport and csimport to different domain

Migration user via csexport and csimport to different domain

In this scenario I'll explain how to migrate/move user calendar via csexport and csimport to different domain. In this scenario I migrate/move user from JES5 to COMMS6 with different domain name.

NOTE
It is even possible to use a different user and different domain as well. So you able to move userA@domain1.tld to userX@domain2.tld with this mechanism.

Example:
Migration from ggreen@logical.tld to ggreen@vmdomain.tld

LDAP User entry on JES5

NOTE
For Calendar migration the ics* attributes are important, so I'll only list the attributes you should take care of. Specially the icsCalendarOwned and icsSubscribed are important, also take care about the mail attribute.

dn: uid=ggreen,ou=People,o=logical.tld,dc=vmdomain,dc=tld
cn: Gustaf Green
givenName: Gustaf

icsCalendar: ggreen@logical.tld
icsCalendarOwned: ggreen@logical.tld$Gustaf Green
icsDWPHost: myjazz.vmdomain.tld
icsStatus: Active
icsSubscribed: ggreen@logical.tld$Gustaf Green
icsTimezone: Europe/Paris

mail: Gustaf.Green@logical.tld

Export on JES5 the calendar of user ggreen@logical.tld

bash-3.00# ./csexport -c ggreen@logical.tld calendar /tmp/ggreen.ics
Calendar ggreen@logical.tld has been exported to /tmp/ggreen.ics

The important lines in the exported file are those where the calendar server user is mention, for example:

the calendar properties itself

X-NSCP-CALPROPS-RELATIVE-CALID:ggreen@logical.tld
X-NSCP-CALPROPS-NAME:Gustaf Green
X-NSCP-CALPROPS-PRIMARY-OWNER:ggreen@logical.tld

the calendar events

ORGANIZER;CN="Gustaf Green"
 ;SENT-BY="Gustaf.Green@logical.tld"
 ;X-S1CS-EMAIL=Gustaf.Green@logical.tld
 :ggreen@logical.tld

X-NSCP-ORGANIZER-EMAIL:Gustaf.Green@logical.tld

NOTE
Your exported user calendar *.ics file may vary and include more places where the user is mention.

LDAP User Entry on COMMS6

NOTE
For Calendar migration the ics* attributes are important, so I'll only list the attributes you should take care of. Specially the icsCalendarOwned and icsSubscribed are important, also take care about the mail attribute.

dn: uid=ggreen,ou=People,o=vmdomain.tld,o=isp
cn: Gustaf Green
givenName: Gustaf

icsCalendar: ggreen@vmdomain.tld
icsCalendarOwned: ggreen@vmdomain.tld$Gustaf Green
icsDWPHost: mycando.vmdomain.tld
icsFirstDay: 2
icsStatus: Active
icsSubscribed: ggreen@vmdomain.tld$Gustaf Green
icsTimezone: Europe/Paris

mail: Gustaf.Green@vmdomain.tld

Calendar Migration

As we're migrate from logical.tld to vmdomain.tld we need the edit the *.ics file which was exported from JES5 system before we're importing the file into COMMS6 user.

NOTE
You need to know that in the exported file all events created and owned by ggreen@logical.tld, when you import this file to "another" user (e.g. another domain) you most likely run into problem.

The solution is to replace the string ggreen@logical.tld with ggreen@vmdomain.tld in the whole exported file before you import this file.

In this scenario we replace the value of LDAP attribute icsCalendar of the "old" user with the value of the LDAP attribute icsCalendar of the "new" user.

TIP
In this example you simply could replace logical with vmdomain in the *.ics file as the user name and the Top Level Domain part are the same.

If you use vi, you could do it by simply typing :1,$s/logical/vmdomain/g

The important lines in the *.ics file looks like this after you have edit it:

For the calendar properties itself:

X-NSCP-CALPROPS-RELATIVE-CALID:ggreen@vmdomain.tld
X-NSCP-CALPROPS-NAME:Gustaf Green
X-NSCP-CALPROPS-PRIMARY-OWNER:ggreen@vmdomain.tld

For the calendar events:

ORGANIZER;CN="Gustaf Green"
 ;SENT-BY="Gustaf.Green@vmdomain.tld"
 ;X-S1CS-EMAIL=Gustaf.Green@vmdomain.tld
 :ggreen@vmdomain.tld

X-NSCP-ORGANIZER-EMAIL:Gustaf.Green@vmdomain.tld

Import on COMMS6

bash-3.00# ./csimport -c ggreen@vmdomain.tld calendar /export/ggreen.ics
Calendar ggreen@vmdomain.tld has been imported from /export/ggreen.ics

NOTE
Be aware to have the same Timezone settings on the Convergence Client as on the Client the user regular use, otherwise the calendar events become imported but displayed "wrong".

Please find below shell script for export and import of calendar, be aware the script are for educational reason only.

Example shell script to export all users:

#!/bin/sh

############################################
###    Export Entire Calendar Database   ###
### ------------------------------------ ###
### M.Button - Sun Technical Support     ###
### 10/04/08 - v1.1                      ###
############################################

#################
### Functions ###
#################

_validate()
{
  ### Chech Command line path is valid ###
  if [ "$dbexportpath" = "" ]
  then
    echo "Error: No export location specified!"
    echo
    echo "Usage:"
    echo "  exportdb.sh [path of exported database]"
    echo
    exit
  fi
  if [ ! -d "$dbexportpath" ]
  then
    echo "Error: Export location specified not found!"
    exit
  fi

  ### Check it is okay to continue with export ###
  
  echo
  echo "Export entire calendar database!"
  echo "--------------------------------"
  echo
  echo "It's highly recommended to shutdown your calendar server before"
  echo "you continue to export the entire database."
  echo
  echo "Export to: $dbexportpath"
  echo
  echo "Do you wish it continue [y/n]?"
  read ask
  if [ "$ask" != "y" ] && [ "$ask" != "Y" ]
  then
    ### Exit if user does not enter Y ###
    exit
  fi
}

_build_cal_list()
{
  ################################
  ### Build Calendar List File ###
  ################################

  echo
  echo "Building Calendar List..."
  ./cscal list | cut -f1 -d" " > $dbexportpath/cal-list

  ### Find EOF ###
  numofcals=`cat $dbexportpath/cal-list | wc -l`
  echo "Found: $numofcals Calendars in database."
}

_export_calendars()
{
  ########################
  ### Export Calendars ###
  ########################

  echo

  for calid in `cat $dbexportpath/cal-list`
  do
    ### Remove ending colon in line ':' ###
    chars=`echo "$calid" | wc -c`
    chars=`expr $chars - 2`
    calid=`echo "$calid" | cut -c1-$chars`

    ### Export Calendar with csexport command ###
    ./csexport -v -c $calid calendar $dbexportpath/$calid.ics >> $dbexportpath/export.log
    echo "Exported: $calid"
  done
}

#############
### Start ###
#############

dbexportpath=$1

_validate
_build_cal_list
_export_calendars

echo
echo "Export process complete!"
echo "  Check $dbexportpath/export.log for details."
echo

### End of Script ###

Example shell script to import all users:

#!/bin/sh

############################################
###    Import Entire Calendar Database   ###
### ------------------------------------ ###
### M.Button - Sun Technical Support     ###
### 10/04/08 - v1.1                      ###
############################################

#################
### Functions ###
#################

_validate()
{
  ### Chech Command line path is valid ###
  if [ "$dbimportpath" = "" ]
  then
    echo "Error: No import location specified!"
    echo
    echo "Usage:"
    echo "  importdb.sh [path to exported database]"
    echo
    exit
  fi
  if [ ! -d "$dbimportpath" ]
  then
    echo "Error: Import location specified not found!"
    exit
  fi

  ### Check it is okay to continue with export ###
  echo
  echo "Import entire calendar database!"
  echo "--------------------------------"
  echo
  echo "It's highly recommended to shutdown your calendar server before"
  echo "you continue to import the entire database."
  echo
  echo "Import from: $dbimportpath"
  echo "`cat $dbimportpath/cal-list | wc -l` calendars to import."
  echo
  echo "Do you wish it continue [y/n]?"
  read ask
  if [ "$ask" != "y" ] && [ "$ask" != "Y" ]
  then
    ### Exit if user does not enter Y ###
    exit
  fi
}

_import_calendars()
{
  ########################
  ### Import Calendars ###
  ########################

  echo

  for calid in `cat $dbimportpath/cal-list`
  do
    ### Remove ending colon in line ':' ###
    chars=`echo "$calid" | wc -c`
    chars=`expr $chars - 2`
    calid=`echo "$calid" | cut -c1-$chars`

    ### Export Calendar with csexport command ###
    ./csimport -v -c $calid calendar $dbimportpath/$calid.ics >> $dbimportpath/import.log
    echo "Imported: $calid"
  done
}

#############
### Start ###
#############

dbimportpath=$1

_validate
_import_calendars

echo
echo "Import process complete!"
echo "  Check $dbimportpath/import.log for details."
echo

### End of Script ###

Labels

calendarserver calendarserver Delete
migrating migrating Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact