0

I have a BQ Ubuntu Phone and use the calendar app in connection with google calendar. I am wondering, if I always have to press "sync" in the calendar app or if there is a way to actually automatically sync my google calendar.

Thanks for your help!

Toni
  • 25
  • 5

1 Answers1

1

To do automatically sync, you can use command lines in terminal app. I think automatically sync is not implemented yet in calendar app.

The method below should work with google calendar (I'm not sure because I use calendar from owncloud server)

To see the name of calendar server you have to sync, you can use this command :

syncevolution --print-configs

The name of the server could be google-calendar or google-calendar-2, ....

Then you should be able to sync your calendar by this command :

syncevolution google-calendar

or google-calendar-2, ...

To automatically run this sync command, a way is to use "crontab job"

You can see this post for some details about crontab in ubuntu touch.

I try to describe below the method 1 using a terminal connected with ssh to the phone :

Edit crontab file with this command :

crontab -e

Add this line at the end of the file :

@daily export DISPLAY=:0.0 && export DBUS_SESSION_BUS_ADDRESS=$(ps -u phablet e | grep -Eo 'dbus-daemon.*address=unix:abstract=/tmp/dbus-[A-Za-z0-9]{10}' | tail -c35) && /usr/bin/syncevolution google-calendar

Then use Ctrl+X to quit and save the file (may have to enter "Y" et "Enter")

After that to restart the cron service :

sudo service cron restart

The "google-calendar" should automatically daily sync. you can replace @daily by @reboot, @midnight, @weekly, ...

Edit 04/06/2015

If you do this in the phone terminal, the crontab file is not saving because of ubuntu touch is on "read file only system" One solution that could work is to switch in read/write mode for the system file (at your own risk) You can for example do :

sudo mount /dev/loop0 / -o remount,rw 

crontab -e

Then modify and save the file like you did.

After that, you can check the file by using :

crontab -l

It's not recommended to switch in read / write mode for normal user. With the previuous command the system return in read mode after reboot. I used this command a lot of time with no ubuntu breaking.

  • Unfortunately, it doesn't work :( When I save the file, I am being asked where to save it. The suggestion is "tmp/crontab.Sw0Qo8/crontab". I just confirm. When I run "crontab -e" again, the file is empty. – Toni Jun 04 '15 at 09:53
  • I edited the post. It could be because you don't have the right to write the crontab file from the terminal app (already happened to me) – alexandre_payet Jun 04 '15 at 12:04
  • Still not working :( I did everything in read/write mode and checked with `crontab -l`. At least this way the crontab was saved. I just copied and pasted your code. The only thing I changed was @daily -> @hourly (which should exist following the cron-wiki). Also I have three calendars google-calendar-1, google-calendar-5, google-calendar-6 (and I dont really know which one I am addressing) so I added your line three times. At the end still now sync after hours. BTW: I'm doing everything via sdk on my laptop (14.04). – Toni Jun 19 '15 at 06:57
  • Sorry this is not working but it's strange. di you try in terminal app : "syncevolution google-calendar-1 -5 or -6" ? How is it going, does it sync your calendar ? Do not forget to do "sudo service cron restart". And you can maybe add "> /home/phablet/log-calendar" at the end of the "@hourly ..... " to see if crontab is doing the job and if there are errors in sync – alexandre_payet Jun 22 '15 at 10:00