-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspwsync
More file actions
executable file
·51 lines (32 loc) · 1.19 KB
/
spwsync
File metadata and controls
executable file
·51 lines (32 loc) · 1.19 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
49
50
51
#! /bin/bash
evtdry=""
del=""
# ssh parameters are stored in
# ~/.ssh/config
if [[ "$3" = "dry" ]] || [[ "$2" = "dry" ]] || [[ "$1" = "dry" ]] ; then
evtdry="--dry-run "
fi
if [[ "$3" = "--delete" ]] || [[ "$2" = "--delete" ]] || [[ "$1" = "--delete" ]] ; then
del="--delete"
fi
if [[ "$1" = "pull" ]] ; then
sourcefolder="shopware.valentinoberson.ch/"
dest="/home/walo/code_the_web/shopware.valentinoberson.ch"
rsync -avz $evtdry --rsh=ssh valenti@valentinoberson.ch:/$sourcefolder $dest $del
else
dest="shopware.valentinoberson.ch"
sourcefolder="/home/walo/code_the_web/shopware.valentinoberson.ch/"
ACTION='rsync -avz $evtdry --rsh=ssh $sourcefolder valenti@valentinoberson.ch:/$dest'
if [[ "$del" = "--delete" ]] ; then
read -p "Deleting on a push rsync can broke the entire site. Are you sure? (Y/n) " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Y]$ ]] ; then
# rsync -avz $evtdry --rsh=ssh $sourcefolder valenti@valentinoberson.ch:/$dest $del
rsync -avz $evtdry $sourcefolder valenti@valentinoberson.ch:/$dest $del
else
echo "Aborded"
fi
else
rsync -avz $evtdry --rsh=ssh $sourcefolder valenti@valentinoberson.ch:/$dest
fi
fi