/ Published in: Bash

Combines .ics files from OS X Server iCal Server into a single merged ics which can then be subscribed to.
I set this up specifically so I could display ical server calendars inside of Zap Calendar on a joomla site. This script could be called from cron.
I set this up specifically so I could display ical server calendars inside of Zap Calendar on a joomla site. This script could be called from cron.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/bin/sh ### VARIABLES ### # Path to user's ical server directory this is where a folder exists for each calendar. calpath="/Volumes/Data/iCal/calendars/__uids__/AC/03/AC0339D9-5D40-41CD-B1C8-4A62333C53FD" # Where to store combined ics files # typically this is a a folder in your web server path. calout="/Volumes/Data/Web/mydomain/ics" ### Do not edit below this line ### cals=`ls $calpath | grep -v dropbox | grep -v inbox` TEMP="/tmp/temp.ics" for cal in $cals; do echo "BEGIN:VCALENDAR PRODID:-//merge//example.com// VERSION:2.0 X-WR-CALNAME:example.com" > $TEMP awk '/BEGIN:VEVENT/,/END:VEVENT/' $calpath/$cal/*.ics >> $TEMP echo "END:VCALENDAR" >> $TEMP tr -d '\r' < $TEMP > $calout/$cal.ics done exit 0
Comments
