forked from mdeff/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
backup
executable file
·30 lines (23 loc) · 802 Bytes
/
backup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
# Before:
# 1. cryptsetup open /dev/sdb backup
# 2. mount /dev/mapper/backup /mnt/backup
# After:
# 1. umount /mnt/backup
# 2. cryptsetup close backup
DATE=$(date -I)
BACKUPDIR=/mnt/backup/${DATE}
LOGFILE=/mnt/backup/${DATE}.log
mkdir ${BACKUPDIR}
echo "Start: $(date -Iseconds)" >> ${LOGFILE}
#cp -a /boot /data /etc /home /opt /root /srv /usr /var /mnt/backup/$DATE/ > ${LOGFILE} 2>&1
cp -ax / ${BACKUPDIR} > ${LOGFILE} 2>&1
cp -ax /boot ${BACKUPDIR} > ${LOGFILE} 2>&1
cp -ax /data ${BACKUPDIR} > ${LOGFILE} 2>&1
echo "End: $(date -Iseconds)" >> ${LOGFILE}
# Ignored root directories:
# * dynamic: /dev /proc /sys
# * temporary: /run /tmp
# * symlinks to /usr/{bin,lib}: /bin /sbin /lib /lib64
# * /lost+found /mnt
# Beware filesystems mounted in /var/lib/dhcpcd/{dev,proc,run,sys}.