Skip to content

Instantly share code, notes, and snippets.

@floreo
Created July 12, 2017 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floreo/4c87f2be29fb39a2c4e8c773d44ae195 to your computer and use it in GitHub Desktop.
Save floreo/4c87f2be29fb39a2c4e8c773d44ae195 to your computer and use it in GitHub Desktop.
Bash script to import ICS into Radicale
#!/usr/bin/env bash
# This script import an ics calendar into Radicale
#TODO: check if the current calendar is up to date before to import it, I tried downloading it and comparing checksums but events ain't in the same order :(
declare -r _RADICALE_CALENDAR_URL="<URL of you Radicale calendar"
declare -r _ICS_CALENDAR_URL="<URL of your ICS calendar>"
declare -r _USERPASSWD="<user>:<password>"
_TEMPORARY_ICS="$(mktemp)"
curl -k --silent --output "${_TEMPORARY_ICS}" -X GET "${_ICS_CALENDAR_URL}"
if [ -s "${_TEMPORARY_ICS}" ] ; then
curl -k --silent --user "${_USERPASSWD}" -X PUT -H "Content-Type: text/calendar; charset=utf-8" --data-binary @"${_TEMPORARY_ICS}" "${_RADICALE_CALENDAR_URL}"
rm "${_TEMPORARY_ICS}"
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment