- One-way syncing of one or more folders via rsync
- Limits the maximum amount of space used on the destination
- Keeps files on the destination for selected amount of time before rotating it out and replacing it with newer files
- The use-case is i.e. syncing photos from the NAS/server to the Android phone with Termux (with sshd and rsync) which uploads files to some cloud service (i.e. Google Photos).
- Tested on PHP 8.2 (php-sqlite3 and pecl inotify extensions required)
- G Pixel phone with G photos sync enabled
- Termux from F-Droid
- Termux:API from F-Droid
- (optional but recommended) Termux:Boot from F-Droid - to start sshd automatically
- setup sshd, install rsync, setup Termux API (
pkg install termux-api
), setup storage mounttermux-setup-storage
- Server/NAS with Nextcloud connected through VPN (i.e. Wireguard) to the network, where you keep your G Pixel phone (i.e. home network)
- Nextcloud client on your phone with photo sync enabled
- Syncer (this app) running on the server/NAS with proper configuration
- don't forget to add your server's/NAS public ssh key to the
~/.ssh/authorized_keys
on your G Pixel Termux - set
/etc/syncer/config.ini
on your server/NAS with proper values - your
post_sync_command
should probably containssh -p 8022 user@<your G Pixel's VPN IP> termux-media-scan -r /mnt/sdcard/DCIM
- your
directory[name]
should contain path where your Nextcloud keeps photos synced from your phone - set
dest_size_max
to the amount of free storage on your G Pixel device (in bytes)15000000000
is recommended value for 32GB variant - set
keep_time_min
it's the minimum time (in seconds) to keep photos on the G Pixel device to allow them to be synced completely to G photos. Change this according to your needs. If your upload speed is slow, you probably want to increase this value. - set
temp_dir
path so it is at the same mountpoint as (photos) source directory
- don't forget to add your server's/NAS public ssh key to the
| |
+--------+ +--------+
| source | | G Pixel|
| phone | |(Termux)|
+--------+ +--------------------+ +--------+
| 1 2 3 | ---Nextcloud sync--> | Server/NAS | ---syncer--> | 1 2 3 |
| 4 5 6 | | running Nextcloud | | 4 5 6 |
| 7 8 9 | +--------------------+ | 7 8 9 |
| * 0 # | | * 0 # |
+--------+ +--------+
|
|
v
.-~~~-.
.- ~ ~-( )_ _
/ ~ -.
| G Photos \
\ .'
~- . _____________ . -~
- maybe create single phar archive?
- exception handling
implement Google Photos API- it can't be used as it does not provide way to filter or sort by uploaded date or total count of objects.