0

I have installed Grive2 console client for Google Drive with the following steps:

sudo add-apt-repository ppa:nilarimogard/webupd8  
sudo apt-get update  
sudo apt-get install grive 

Then I created folder for sync and log-in to my Google account:

mkdir ~/GoogleDrive
cd GoogleDrive
grive -a

Then I reboot my system, and can't find any services for grive.
So I tried to investigate the file list installed by grive package:

$ dpkg -L grive
/.
/usr
/usr/lib
/usr/lib/grive
/usr/lib/grive/grive-sync.sh
/usr/lib/systemd
/usr/lib/systemd/user
/usr/lib/systemd/user/grive-changes@.service
/usr/lib/systemd/user/grive-timer@.service
/usr/lib/systemd/user/grive-timer@.timer
/usr/bin
/usr/bin/grive
/usr/share
/usr/share/doc
/usr/share/doc/grive
/usr/share/doc/grive/changelog.Debian.gz
/usr/share/doc/grive/copyright
/usr/share/man
/usr/share/man/man1

Here are 3 interesting systemd-related items:

$ dpkg -L grive | grep systemd/user/
/usr/lib/systemd/user/grive-changes@.service
/usr/lib/systemd/user/grive-timer@.service
/usr/lib/systemd/user/grive-timer@.timer

Their contents are as follows:

$ cat /usr/lib/systemd/user/grive-changes@.service
[Unit]
Description=Google drive sync (changed files)

[Service]
ExecStart=/usr/lib/grive/grive-sync.sh listen "%i"
Type=simple
Restart=always
RestartSec=30

[Install]
WantedBy=default.target

$ cat /usr/lib/systemd/user/grive-timer@.service
[Unit]
Description=Google drive sync 
After=network-online.target

[Service]
ExecStart=/usr/lib/grive/grive-sync.sh sync "%i"

$ cat /usr/lib/systemd/user/grive-timer@.timer
[Unit]
Description=Google drive sync (fixed intervals)

[Timer]
OnCalendar=*:0/5
OnBootSec=3min
OnUnitActiveSec=5min
Unit=grive-timer@%i.service

[Install]
WantedBy=timers.target

So it seems that grive has internal functionality to automate synchronization.
And there is no need to invent another bicycle with cron scheduler.

But I'm not familiar with systemd user's timers and services.

Found forum post on ArchLinux, but can't understand how to combine it with grive files.

What should I do to enable grive services and timers?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.