Receiving a Daily Summary of Sun Java System Calendar Server Events and Tasks by Email

Mike de Laine, February 2007

This tech tip describes how to provide your Sun Java System Calendar Server users with a daily summary of their Sun Java System Calendar Server events and tasks, emailed to their inbox or mobile device each weekday morning. You do this by creating a Bourne shell script,, which uses Web Calendar Access Protocol (WCAP) commands. On a daily basis, this script finds all events and tasks from your users' calendars then emails them to the individual users. A cron job executes the script according to your preferences. The email that users receive resembles the following:

Times shown in America/Los_Angeles
Directory setup meeting
 Starts  10/23/2006 14:00
Reminder: Directory setup meeting
 SunIT Directory setup meeting 866 835 8198 9325445
Writer's Workshop
 Starts  10/23/2006 18:00
 Writer's Workshop
Car - book service
 Starts  10/23/2006 09:00 

Overview of the Script

This idea uses the WCAP protocol to communicate with Calendar Server, and wget as the WCAP driver. For more information on the WCAP protocol, see Chapter 5, Web Calendar Access Protocol Overview, in the Sun Java System Calendar Server 6 2005Q4 Developer's Guide.

The Bourne shell script performs the following actions on behalf of each Calendar Server user:

  • Log in (by using proxy authentication) as the user
  • Get the user's events
  • Reformat the events into more readable form
  • Email the reformatted output to the user
  • Log out of the connection

To Create the Script
  1. On the Calendar Server host, become superuser.
  2. Create a directory to hold the script. The directory needs to be owned and executable by root. (You might already have a tools or scripts directory that you can use.) In addition, the script needs access to the ics.conf configuration file, so you can avoid having to hard-code variables relating to Calendar Server.
  3. Create the script from the sample, editing the file where necessary for your site's configuration.
  4. Set up the subscriber files as shown in the show_subscribers module, which contains the user information.
      # produce the list of recipients in the form of
      #       calid email_address # note email_address is optional
      # from our data file
      # if pager/cellphone email address is not given,
      # we'll send their summary to their email address listed in LDAP
    For example, create a file called daily_summary_7.recipients that contains the calendar IDs and email addresses:
  5. Schedule the script's execution via cron. For example, you might want to run the cron job only on weekdays:
    02 7 * * 1,2,3,4,5 /opt/tools/
    This will run the job at 7:02 a.m. Monday through Friday.

Sample Script
Select Script

Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License.

Left Curve
Popular Downloads
Right Curve
Untitled Document
Left Curve
More Systems Downloads
Right Curve