「Backup」:修訂間差異
创建页面,内容为“== 範例 == == 相關連結 == * restic” |
無編輯摘要 |
||
第1行: | 第1行: | ||
== 範例 == | == 範例 == | ||
<syntaxhighlight lang="bash"> | |||
#!/bin/bash | |||
umask 077 | |||
export B2_ACCOUNT_ID="x" | |||
export B2_ACCOUNT_KEY="x" | |||
export RESTIC_PASSWORD="x" | |||
# Directory | |||
sudo tar cf - /srv/foo | zstd -19 -cf -T0 -o /tmp/foo.tar.zst --rsyncable | |||
restic -r b2:gslin-backup-kennel backup /tmp/foo.tar.zst | |||
# MySQL | |||
mysqldump foo | zstd -19 -cf -T0 -o /tmp/foo-mysql.tar.zst --rsyncable | |||
restic -r b2:gslin-backup-kennel backup /tmp/foo-mysql.tar.zst | |||
# Prune | |||
restic -r b2:gslin-backup-bucket forget --keep-daily=7 --keep-weekly=4 --keep-monthly=3 --keep-yearly=3 | |||
restic -r b2:gslin-backup-bucket prune | |||
</syntaxhighlight> | |||
== 相關連結 == | == 相關連結 == | ||
* [[restic]] | * [[restic]] |
於 2025年3月30日 (日) 03:19 的修訂
範例
#!/bin/bash
umask 077
export B2_ACCOUNT_ID="x"
export B2_ACCOUNT_KEY="x"
export RESTIC_PASSWORD="x"
# Directory
sudo tar cf - /srv/foo | zstd -19 -cf -T0 -o /tmp/foo.tar.zst --rsyncable
restic -r b2:gslin-backup-kennel backup /tmp/foo.tar.zst
# MySQL
mysqldump foo | zstd -19 -cf -T0 -o /tmp/foo-mysql.tar.zst --rsyncable
restic -r b2:gslin-backup-kennel backup /tmp/foo-mysql.tar.zst
# Prune
restic -r b2:gslin-backup-bucket forget --keep-daily=7 --keep-weekly=4 --keep-monthly=3 --keep-yearly=3
restic -r b2:gslin-backup-bucket prune