Advertisement
Guest User

Untitled

a guest
Sep 13th, 2018
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.93 KB | None | 0 0
  1. #!/bin/sh
  2. REPOSITORY=ssh://francescoprovino@path/to/backup
  3.  
  4. # Setting this, so you won't be asked for your repository passphrase:
  5. export BORG_PASSPHRASE='XXXXXXXXXXXXXX'
  6. # or this to ask an external program to supply the passphrase:
  7. export BORG_PASSCOMMAND='pass show backup'
  8.  
  9.  
  10. nextcloud.occ maintenance:mode --on
  11. # Backup all of /home and /var/www except a few
  12. # excluded directories
  13. borg create -v -p --stats                          \
  14.         --compression lz4                       \
  15.         $REPOSITORY::'{hostname}-{now:%Y-%m-%d}'    \
  16.         /var/snap/nextcloud/
  17.  
  18. # Use the `prune` subcommand to maintain 7 daily, 4 weekly and 6 monthly
  19. # archives of THIS machine. The '{hostname}-' prefix is very important to
  20. # limit prune's operation to this machine's archives and not apply to
  21. # other machine's archives also.
  22. nextcloud.occ maintenance:mode --off
  23. borg prune -v --list --prefix '{hostname}-' --keep-last 10 $REPOSITORY
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement