Last active
September 28, 2016 18:55
-
-
Save libraplanet/eccd4c3c5caa8306bc69dc41e3cd78e6 to your computer and use it in GitHub Desktop.
sync google drive using grive2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=grive sync timer | |
[Timer] | |
OnBootSec=10min | |
OnCalendar=*-*-* *:5,15,25,35,45,55:00 | |
[Install] | |
WantedBy=timers.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
◆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