Skip to content

Instantly share code, notes, and snippets.

@libraplanet
Last active September 28, 2016 18:55
Show Gist options
  • Save libraplanet/eccd4c3c5caa8306bc69dc41e3cd78e6 to your computer and use it in GitHub Desktop.
Save libraplanet/eccd4c3c5caa8306bc69dc41e3cd78e6 to your computer and use it in GitHub Desktop.
sync google drive using grive2.
[Unit]
Description=grive sync service
After=network.target
[Service]
User=grive
Group=grive
Type=simple
ExecStart=~/grive.sh
KillMode=control-group
[Install]
WantedBy=multi-user.target
#!/bin/sh
echo "sync task start."
grive -p /home/grive/sync -s /work/sync
echo "delete old files."
find "/home/grive/sync/.trash/" -type f -mtime +5 -delete -print
echo "delete empty directories"
find "/home/grive/sync/.trash/" -type d -empty -delete -print
echo "sync end."
[Unit]
Description=grive sync timer
[Timer]
OnBootSec=10min
OnCalendar=*-*-* *:5,15,25,35,45,55:00
[Install]
WantedBy=timers.target
◆grive2
https://github.com/vitalif/grive2
◆install
-> http://yourcmc.ru/wiki/Grive2#Installation
◆define
・sync user
user : grive
group : grive
・sync dir
local : /home/grive/sync
drive : /work/sync
◆first run. (with -a option.)
$ grive -a -p /home/grive/sync -s /work/sync
◆regularly run. (with out -a option.)
$ grive -p /home/grive/sync -s /work/sync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment