Importing ICS File fails
I would like to import via a Cronjob a ICS Calendarfile which is exported from SabreDAV 3.20. This file is saved on the local disk. If i import this file manually, it's imported successfully without any error. However, since i need this more often, i have written a small bash Script, which should import the *.ics file for me, but it didn't seem to work, the calendar stays empty. Here is the small Script:
#!/bin/bash
user="username"
PASS="somepassword"
file="/path/to/calendarfile/user@domain.com/files/4b28cc38-4069-4946-bd3a-3189c79bc741-2017-10-06.ics"
url="http://localhost:81/mail/"
token=`curl -c cookies -X GET $url |grep "name=\"_token" |sed 's/.*value="\([^"]*\)".*/\1/'`
echo "Token: $token"
curl -L -b cookies -c cookies -X POST -e $url -F"_action=login" -F"_pass=$PASS" -F"_task=login" -F"_timezone=Europe/Berlin" -F"_token=$token" -F"_url=" -F"_user=$user" $url >/dev/null
token=`curl -L -b cookies -c cookies -X GET -F"_task=calendar" -F"_action=_action=import_events" -e $url $url |grep "name=\"_token" |sed 's/.*value="\([^"]*\)".*/\1/'`
echo "Token: $token"
curl -L -b cookies -c cookies -X POST -F "_data=@$file" -F"_task=calendar" -F"_action=import_events" -F"calendar=3" -F"_range=1" -F"_token=$token" -e $url $url >/dev/null
I hope someone can help me.