An automatic backup and sync utility that watches directories. It listens to filesystem events on these directories and copies their content to remote destinations. A remote destination can be a folder on the local filesystem, a network drive mounted on the filesystem, or a bucket on a cloud storage provider. See the list of supported providers here.
Linux
- rclone
- inotify-tools
The only repository supported for now is the AUR. To install otoclone
on Arch
Linux, use any AUR helper of your choice. Example with yay
:
yay -S otoclone
-
Make sure
inotify-tools
is installed -
Install
rclone
. To verify if it's installed, runrclone --version
-
Configure your remotes (backup destinations) in rclone by running
rclone config
. For more details on how to install and configure rclone check out their website. -
Configure Otoclone with the command
otoclone config
. This will create a configuration file calledconfig.yml
in$XDG_CONFIG_HOME/otoclone
. (or in$HOME/.config/otoclone
if you don't have$XDG_CONFIG_HOME
set)
The configuration file has the following structure:
config.yml
----------
folders:
documents:
path: /home/jim/documents
strategy: sync
remotes:
- name: Dropbox
bucket: documents
- name: OneDrive
bucket: docs
- name: S3
bucket: Documents
ignoreList:
- ignore-me.txt
excludePattern: "*.jpg"
photos:
path: /home/jim/photos
strategy: copy
remotes:
- name: GoogleDrive
bucket: Pix
Field | Required? | Description | Example |
---|---|---|---|
path |
Yes | The path of the folder to watch | home/jim/documents |
strategy |
Yes | The backup strategy to use. Currently there are 2 supported strategies: copy and sync |
copy |
remotes |
Yes | The remote destination to transfer data to. Two fields are required for the remote: - name : the name of the remote as defined in rclone. To list configured remotes, run rclone listremotes - bucket : the path of the destination folder on the remote. |
name: Dropbox bucket: backup/docs |
ignoreList |
No | A list of files whose filesystem events should be ignored. These files are not ignored during backup however. |
file1.lock |
excludePattern |
No | The pattern to exclude based on file globs as used by the Unix shell. For more details see rclone 's documentation. |
*.jpg |
To start watching folders defined in the configuration for changes run:
otoclone
To execute a one time backup of a single folder run:
otoclone backup -f MY_FOLDER
Omitting the -f
flag will backup all folders defined in the configuration
For a list of all available commands and flags run: otoclone -h
git clone https://github.com/ilyessbachiri/otoclone
cd otoclone/
go build -o otoclone
Add the binary to /usr/local/bin
sudo mv otoclone /usr/local/bin
If you don't have root privileges or you choose not to touch /usr/local/bin
, you can
copy the binary into ~/.local/bin/
. If this is your case, make sure
~/.local/bin
is part of your $PATH
env variable.
systemd
can be used on Linux to run otoclone
as a service on boot and
restart it if it ever fails. Here's an example of how to accomplish this.
-
Add a systemd service file to manage
otoclone
under/etc/systemd/system/
. You can name itotoclone.service
for example.otoclone.service ---------------- [Unit] Description=Automatic backup After=network.target [Service] Type=simple # Another Type: forking User=jim WorkingDirectory=/home/jim ExecStart=otoclone Restart=on-failure # Other restart options: always, on-abort, etc # The install section is needed to use # `systemctl enable` to start on boot # For a user service that you want to enable # and start automatically, use `default.target` # For system level services, use `multi-user.target` [Install] WantedBy=default.target
-
Enable the service using:
systemctl enable otoclone
-
Start the service using:
systemctl start otoclone
If everything is configured properly you should see the otoclone
service
active when you run: systemctl status otoclone
Like any other systemd service the logs can be found in journalclt
:
journalctl -u otoclone