Skip to content

Commit a22cf19

Browse files
committed
Adds backup
1 parent a7dac9a commit a22cf19

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

backup

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test

restore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test

test

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env sh
2+
3+
WORKDIR="$(cd "$(dirname "$0")"; pwd)" # <--
4+
# url path
5+
RSYNC_URL="rsync://localhost:8873"
6+
BACKUPDIR="$WORKDIR/RSFA_backups"
7+
node1='root'
8+
node2='sdcard'
9+
# rsync default options
10+
MIRROR='-rlpt' # for root FS
11+
ARCHIVE='-rt' # for sdcard FUSE FS
12+
INFO='hi'
13+
#HASH='--checksum'
14+
PRUNE='--delete'
15+
#PROGR='--progress'
16+
17+
case "$(basename "$0")" in
18+
*backup*)
19+
ACTION=backup;;
20+
*restore*)
21+
ACTION=restore;;
22+
*test*)
23+
ACTION=test;;
24+
*)
25+
ACTION=test;;
26+
esac
27+
28+
for _f in $node1 $node2; do
29+
mkdir -p "$BACKUPDIR/$_f" 2>/dev/null
30+
done
31+
32+
33+
34+
case "$ACTION" in
35+
backup)
36+
rsync $ARCHIVE$INFO $HASH $PRUNE $PROGR --exclude='.$Trash$/' --exclude='Android/' "$RSYNC_URL/$node2/" "$BACKUPDIR/$node2/"
37+
;;
38+
restore)
39+
rsync $ARCHIVE$INFO $HASH $PROGR --exclude='.$Trash$/' --exclude='Android/' "$BACKUPDIR/$node2/" "$RSYNC_URL/$node2/"
40+
;;
41+
test)
42+
rsync --list-only $RSYNC_URL
43+
;;
44+
esac

0 commit comments

Comments
 (0)