restic备份软件的包装脚本,用于初始化、创建、修剪和检查备份
runrestic的Python项目详细描述
概述
runrestic是 Restic启动备份的备份软件, 根据保留策略删除所有旧备份,并验证备份 为了一致性。脚本支持在声明性语句中指定设置。 配置文件,而不是将它们全部放在命令行中,并且 处理常见错误。
下面是一个配置文件示例:
repositories=["/tmp/restic-repo","sftp:user@host:/srv/restic-repo","s3:s3.amazonaws.com/bucket_name"][environment]RESTIC_PASSWORD="CHANGEME"[backup]sources=["/home","/var"][prune]keep-last=3keep-hourly=5
有关更全面的示例,请参见example.toml或检查schema.json
入门
要启动并运行,请先install Restic。
要安装runrestic,请运行以下命令下载并安装它:
sudo pip3 install --upgrade runrestic
请注意,pip二进制文件的名称可能与pip3
不同。确保
您正在使用python 3,因为runrestic不支持python 2。
一旦您准备好了restic
和runrestic
,您应该在扫描的位置上放置一个配置文件,即:
- /etc/runrestic.toml
- /etc/runrestic/example.toml
- ~/.config/runrestic/示例.toml
然后,运行
runrestic init # to initialize all the repos in `repositories` runrestic # without actions will do: runrestic backup prune check# or runrestic [action]
自动驾驶仪
如果你想自动运行runrestic,比如每天运行一次,你可以 配置作业运行程序以定期调用它。
克朗
如果您使用的是cron,请下载sample cron file。 然后,从您下载它的目录:
sudo mv runrestic /etc/cron.d/runrestic sudo chmod +x /etc/cron.d/runrestic
系统d
如果使用systemd而不是cron来运行作业,请下载sample systemd service file 以及sample systemd timer file。 然后,从下载它们的目录:
sudo mv runrestic.service runrestic.timer /etc/systemd/system/
sudo systemctl enable runrestic.timer
sudo systemctl start runrestic.timer
谢谢
这个项目的大部分是从borgmatic复制和粘贴的。