-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathetc_rsync_backup.sh
More file actions
executable file
·49 lines (36 loc) · 1.38 KB
/
Copy pathetc_rsync_backup.sh
File metadata and controls
executable file
·49 lines (36 loc) · 1.38 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# ----------------------------------------------------------------------
# mikes handy rotating-filesystem-snapshot utility
# ----------------------------------------------------------------------
# this needs to be a lot more general, but the basic idea is it makes
# rotating backup-snapshots of /home whenever called
# ----------------------------------------------------------------------
if [ -f "/DISKFULL" ]
then
echo "Disk if full. Aborting Backup"
exit 1
fi
# ------------- system commands used by this script --------------------
ID=/usr/bin/id
ECHO=/bin/echo
MOUNT=/bin/mount
RM=/bin/rm
MV=/bin/mv
CP=/bin/cp
TOUCH=/usr/bin/touch
DATE=/bin/date
RSYNC=/usr/bin/rsync
WEEK_DAY=`${DATE} "+%w"`
# ------------- file locations -----------------------------------------
SOURCE="/etc"
DESTINATION_FOLDER="/backup/etc"
EXCLUDES=/root/Scripts/etc_excludes.txt
# ------------- the script itself --------------------------------------
# make sure we're running as root
#if (( `$ID -u` != 0 )); then { $ECHO "Sorry, must be root. Exiting..."; exit; } fi
#${RSYNC} -avz --delete --delete-excluded \
# --exclude-from="${EXCLUDES}" \
# $SOURCE ${DESTINATION_SERVER}:${DESTINATION_FOLDER}/${WEEK_DAY}/
${RSYNC} -av --cvs-exclude --delete --delete-excluded \
--exclude-from="${EXCLUDES}" \
${SOURCE}/ ${DESTINATION_FOLDER}/${WEEK_DAY}/