HashBackup set up: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
* Create the user/group <code>hb</code> (329 is the [https://slackbuilds.org/uid_gid.txt UID/GID] of "oracle-xe" removed from [https://slackbuilds.org SBo]) | * Create the user/group <code>hb</code> (329 is the [https://slackbuilds.org/uid_gid.txt UID/GID] of "oracle-xe" removed from [https://slackbuilds.org SBo]) | ||
<pre> | <pre> | ||
groupadd -g 329 hb | # groupadd -g 329 hb | ||
useradd -u 329 -g 329 -s /sbin/nologin -M hb | # useradd -u 329 -g 329 -s /sbin/nologin -M hb | ||
</pre> | </pre> | ||
* Download <code>hb</code> from https://www.hashbackup.com/hashbackup/download.html to <code>/usr/local/sbin/hb</code> | * Download <code>hb</code> from https://www.hashbackup.com/hashbackup/download.html to <code>/usr/local/sbin/hb</code> | ||
Revision as of 00:09, 24 December 2022
# groupadd -g 329 hb # useradd -u 329 -g 329 -s /sbin/nologin -M hb
- Download
hbfrom https://www.hashbackup.com/hashbackup/download.html to/usr/local/sbin/hb# chown root:hb /usr/local/sbin/hb# chmod 750 /usr/local/sbin/hb# setcap cap_dac_read_search=+ep /usr/local/sbin/hb
# mkdir /var/hashbackup# chown hb:hb /var/hashbackup# chmod 700 /var/hashbackup
$ sudo -u hb /usr/local/sbin/hb init -c /var/hashbackup- Create
/var/hashbackup/dest.conf
destname slack type s3 host example.com accesskey ... secretkey ... bucket hb-slack class ia secure
# chown hb:hb /var/hashbackup/dest.conf# chmod 400 /var/hashbackup/dest.conf
- Customize
/var/hashbackup/inex.conf
ex /home/user/.bash_history ex /home/user/.cache ex /home/user/.dvdcss ex /home/user/.ccache ex /home/user/.emacs.d ex /home/user/.fontconfig ex /home/user/.gvfs ex /home/user/.local/share/Trash ex /home/user/.local/share/bashrun*/history ex /home/user/.local/tmp ex /root/.bash_history ex /root/.cache ex /root/.ccache ex /root/.dvdcss ex /root/.emacs.d ex /root/.fontconfig ex /root/.gvfs ex /root/.local/share/Trash ex /root/.local/share/bashrun*/history ex /root/.local/tmp ex /var/tmp/ ex /var/cache ex /var/run ex /var/spool/cron/cron.* ex /var/lib/dhcpcd ex /usr/local/var/.hb-daily-marker ex /usr/local/mysqlbackups/backup.xb.gz ...
- Set configuration options:
hb config cache-size-limit ...GB hb config dedup-mem ...GB hb config copy-executable True hb config no-backup-tag .nobackup,CACHEDIR.TAG hb config pack-age-days 0 hb config pack-download-limit 10TB hb config pack-percent-free 10
/etc/cron.daily/check-CACHEDIR.TAG
#!/bin/bash l=$(for f in $(locate CACHEDIR.TAG); do head -n 1 "$f" \ | grep -v "^Signature: 8a477f597d28d172789f06886806bc55" \ > /dev/null && echo "$f"; done) if [[ $l ]]; then echo "CACHEDIR.TAG files without \ 'Signature: 8a477f597d28d172789f06886806bc55':" echo echo "$l" fi
/etc/cron.daily/hb-marker
#!/bin/bash /bin/touch /usr/local/var/.hb-daily-marker
/etc/profile.d/hb.sh
HASHBACKUP_DIR=/var/hashbackup export HASHBACKUP_DIR
/usr/local/sbin/hb-backup.sh, to be added to cron
#!/bin/bash
export HASHBACKUP_DIR=/var/hashbackup
set -e -o pipefail
hb=/usr/local/sbin/hb
marker=/usr/local/var/.hb-daily-marker
if [ -f $marker ]; then
n=$($hb upgrade 2>&1 >/dev/null)
if [[ $n ]]; then
echo "$n" | /usr/bin/mail -s "$(echo "$n" | tail -n 1)" user@example.org
chown root:hb $hb
chmod 750 $hb
setcap cap_dac_read_search=+ep $hb
fi
fi
hb="sudo -u hb /usr/local/sbin/hb"
$hb backup /boot /etc /home /opt /root /srv /usr/local /var
$hb retain -t 10d -s safe -x 3m
if [ -f $marker ]; then
$hb tune
$hb selftest
$hb dest verify
rm $marker
fi
# chmod 700 /usr/local/sbin/hb-backup.sh
/home/user/.bash_aliases
alias hb='sudo -u hb /usr/local/sbin/hb'
or /root/.bash_aliases
alias hb='sudo -u hb /usr/local/sbin/hb' alias root-hb='/usr/local/sbin/hb'