Simple script for utilizing proton-drive-cli to sync directories on Linux/BSD systems.
| pdrive-cli-sync.sh | Update README and add notes to source. | |
| README.md | Update README and add notes to source. | |
pdrive-cli-sync.sh
A Bash wrapper for syncing directories to Proton Drive utilizing proton-drive-cli. Useful for configuring cron jobs.
NOTE: If you only have a single path to backup, this wrapper just adds extra steps. This is useful if you specifically want to iterate over a set of paths to backup to the same location on Proton Drive.
Setup
- Download proton-drive.
- Add the executable flag to proton-drive:
chmod +x proton-drive. - Perform the steps to authenticate your account:
./proton-drive auth login. - Set the configuration variables in
pdrive-cli-sync.sh.
Configuration
All required parameters are simply for passing values to the upload endpoint of the proton-drive application.
- Set
PDRIVE_CLI_PATHto set the path where theproton-driveexecutable is stored. - Set
PDRIVE_SYNC_PATHto set the directory to write to within Proton Drive. - Set the
SYNC_DIRSfor the values of all discrete paths to backup toPDRIVE_SYNC_PATH. - OPTIONAL:
- Setting
PDRIVE_CONFLICT,PDRIVE_FILE_CONFLICTorPDRIVE_FOLDER_CONFLICTall have the values of "merge", "keep-both", "replace" or "skip."PDRIVE_CONFLICTis hierarchical to FILE/FOLDER. - Setting
PDRIVE_SKIP_THUMBNAILSsimply is true|false.
- Setting
Usage
To perform a check of the configuration before syncing:
$ bash pdrive-cli-sync.sh -c
To run the sync, simply pass with no arguments once the parameters are set in the script:
$ bash pdrive-cli-sync.sh
To set in a cron job for your user:
$ crontab -e
And then set a schedule in your editor:
@weekly /bin/bash /path/to/pdrive-cli-sync.sh
Troubleshooting
"proton-drive executable not found"
- Ensure
PDRIVE_CLI_PATHpoints to the correct location - Verify the file is executable:
chmod +x /path/to/proton-drive
"Directory does not exist"
- Verify all paths in
SYNC_DIRSare correct - Use absolute paths (starting with
/or~/) - Check directory permissions
Sync failures
- Check your Proton Drive credentials
- NOTE:
proton-driveCLI does not provideauth check- credential store may have an expiry timeframe.
- NOTE:
TODO
- Provide method upstream to tool for performing auth checks.
- Provide logging path/parameters and verbosity settings.
- Add commandline overrides.
- Add ability to pass dynamic directory paths and destiations in configuration file.
- Add error handling for nonexistent local/remote paths.
- Determine a method for adding file/folder exclusions.