This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision |
| linux:backup [2021/08/21 18:46] – admin | linux:backup [2024/06/03 13:48] (current) – [full local backup to tmp] admin |
|---|
| |
| * [[https://www.cyberciti.biz/faq/howto-use-tar-command-through-network-over-ssh-session/|howto-use-tar-command-through-network-over ssh session ]] | * [[https://www.cyberciti.biz/faq/howto-use-tar-command-through-network-over-ssh-session/|howto-use-tar-command-through-network-over ssh session ]] |
| | * AI ''what is best way to backup dokuwiki on docker and save 2 last copies on google disk. if possible need to use only bash script'' |
| |
| ===== Backup ===== | ===== Backup ===== |
| |
| |
| ==== check session ( specially for x ) ==== | ==== check session (specially for X) ==== |
| ls /usr/bin/*session | ls /usr/bin/*session |
| |
| |
| * only if root available for login SSH | * only if root available for login SSH |
| | <code BASH> |
| ssh root@bot.ip2u.ru 'cd / && tar -cvf - --exclude=/backup.tar.gz --exclude=/proc --exclude=/tmp --exclude=/mnt --exclude=/dev --exclude=/sys --exclude=/run --exclude=/media --exclude=/var/log --exclude=/var/lib/lxcfs/ --exclude=/var/cache/apt/archives / | gzip -9 ' | pv | cat > /mnt/d/backup/bot-ar/bot-ar-`date +%m-%d-%Y`.tgz | ssh root@bot.ip2u.ru 'cd / && tar -cvf - --exclude=/backup.tar.gz --exclude=/proc --exclude=/tmp --exclude=/mnt --exclude=/dev --exclude=/sys --exclude=/run --exclude=/media --exclude=/var/log --exclude=/var/lib/lxcfs/ --exclude=/var/cache/apt/archives / | gzip -9 ' | pv | cat > /mnt/d/backup/bot-ar/bot-ar-`date +%m-%d-%Y`.tgz |
| | </code> |
| |
| |
| * brotli - very slow | * brotli - very slow |
| tar -cf - --exclude=/backup.tar.gz --exclude=/proc --exclude=/tmp --exclude=/mnt --exclude=/dev --exclude=/sys --exclude=/run --exclude=/media --exclude=/var/log --exclude=/var/cache/apt/archives / | brotli | pv | cat > /tmp/bot-ar-`date +%m-%d-%Y`.tar.bt | tar -cf - --exclude=/backup.tar.gz --exclude=/proc --exclude=/tmp --exclude=/mnt --exclude=/dev --exclude=/sys --exclude=/run --exclude=/media --exclude=/var/log --exclude=/var/cache/apt/archives / | brotli | pv | cat > /tmp/bot-ar-`date +%m-%d-%Y`.tar.bt |
| | |
| | |
| | * local run save to ssh |
| | <code BASH> |
| | tar -cvf - --exclude=/backup.tar.gz --exclude=/proc --exclude=/tmp --exclude=/mnt --exclude=/dev --exclude=/sys --exclude=/run --exclude=/media --exclude=/var/log --exclude=/var/lib/lxcfs/ --exclude=/var/cache/apt/archives / | gzip -9 | ssh user@remote_server.example.com 'cat > /path/to/backup/bot-ar-`date +%m-%d-%Y`.tgz' |
| | </code> |