~increscent/syncd

Keep all my regular files synced across devices
Changed timeout to 30 seconds
Added timeouts to reads and writes
Close file descriptor after freeing SSL

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~increscent/syncd
read/write
git@git.sr.ht:~increscent/syncd

You can also use your local clone with git send-email.

#syncd

Decentralized file syncing daemon

#How it works

Syncd is meant to run on any type of computer: mobile, desktop, server. It can run as a client instance or a server instance. Both instances may run on the same machine. The client instance connects to one or more remote server instances, and compares files. Syncd fill in missing files, updates changed files, and deletes files as well. In order to know whether to delete a file, syncd keeps a persistent cache of file modification times. If the file is in the cache, but not in the file system, syncd assumes the file has been deleted.

#Building & Installing

Dependencies:

# Use gmake on FreeBSD
make
sudo make install

#Setup (Linux)

make setup-linux
make enable-client-linux
make enable-server-linux

These commands add a default configuration file to ~/.config/syncd and add systemd client and server units to ~/.config/systemd/user. The client is triggered by a systemd timer that runs every 5 minutes. You can also run the client by running syncd. The server is a systemd daemon. You can run the server manually with syncd --server.

If you need to reinstall syncd while the server is running, use make install-linux-server.

#Setup (FreeBSD)

gmake setup-freebsd
sudo gmake enable-server-freebsd

These commands do the same as the Linux versions with the following differences:

  • The default config is a server config instead of a client one (you'll want to edit it either way).
  • On FreeBSD the server is run as an RC service instead of a systemd one. The client is not run automatically, but you could always make a cron job for it.
  • The command to re-install syncd while the service is running is: sudo gmake install-freebsd-service

#Configuration

The default configuration location is ~/.config/syncd/config. If you want to use a different configuration file, specify it as a command-line argument to syncd. Enter the certs directory and run make if you need to generate a key/cert pair or a password. Configuration options are explained in the following sample configuration files:

There should only be at most one Server entry, and there can be any number of Host entries. The Server entry is only used when syncd is run as a server (syncd --server), and the Host entries are only used when syncd is run as a client (syncd). There should be one or more Dir entries. These are the actual directories that are syncd. The directory must have the same name on the server and client, but it does not need to have the same path.

#Questions & Feedback

If you use this project, I'd love to hear your feedback! Send me mail at robert at increscent dot org.