File tree 3 files changed +50
-5
lines changed
vagrant/provisioning/roles/mystamps-backup/tasks
3 files changed +50
-5
lines changed Original file line number Diff line number Diff line change 1
1
# /etc/cron.d/mystamps-backup-remote file for backuping my-stamps.ru data to remote host
2
2
MAILTO=coder
3
3
#
4
- # min hour dom mon dow user command
5
- 45 0 * * * mystamps duplicity --name=uploads --no-compression --no-encryption /data/uploads {{ uploads_target_url }} 2>&1
6
- 50 0 * * * mystamps PASSPHRASE='{{ gpg_passphrase }}' duplicity --name=mysql-backups --no-compression /data/backups {{ mysql_backups_target_url }} 2>&1
4
+ # min hour dom mon dow user command
5
+ 45 0 * * * root /data/bin/remote-backup.sh uploads 2>&1
6
+ 50 0 * * * root /data/bin/remote-backup.sh mysql-backups 2>&1
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -o nounset
4
+ set -o errexit
5
+
6
+ UPLOADS_DST=' {{ uploads_target_url }}'
7
+ MYSQL_BACKUPS_DST=' {{ mysql_backups_target_url }}'
8
+ PASSPHRASE=' {{ gpg_passphrase }}'
9
+
10
+ case " ${1:- } " in
11
+ ' uploads' )
12
+ su \
13
+ mystamps \
14
+ -c " duplicity --name=uploads --no-compression --no-encryption /data/uploads ${UPLOADS_DST} " \
15
+ 2>&1
16
+ ;;
17
+ ' mysql-backups' )
18
+ PASSPHRASE=" $PASSPHRASE " su \
19
+ mystamps \
20
+ -c " duplicity --name=mysql-backups --no-compression /data/backups ${MYSQL_BACKUPS_DST} " \
21
+ 2>&1
22
+ ;;
23
+ * )
24
+ echo 2>&1 " Usage: $( dirname " $0 " ) (uploads|mysql-backups)"
25
+ exit 1
26
+ esac
Original file line number Diff line number Diff line change 53
53
creates : /etc/duplicity/cacert.pem
54
54
warn : no
55
55
56
- - name : Creating a cron task for backup to a remote host
56
+ - name : Creating /data/bin directory
57
+ file :
58
+ path : /data/bin
59
+ state : directory
60
+ owner : root
61
+ group : root
62
+ mode : ' 0755'
63
+
64
+ # @todo #705 remote-backup.sh: find a way to protect duplicity against ps
65
+ - name : Creating a script for doing remote backup
57
66
template :
67
+ src : ../../src/main/scripts/remote-backup.sh
68
+ dest : /data/bin/remote-backup.sh
69
+ force : yes
70
+ backup : no
71
+ owner : root
72
+ group : root
73
+ mode : ' 0700'
74
+
75
+ - name : Creating a cron task for backup to a remote host
76
+ copy :
58
77
src : ../../src/main/config/cron/mystamps-backup-remote
59
78
dest : /etc/cron.d/mystamps-backup-remote
60
79
force : yes
61
80
backup : no
62
81
owner : root
63
82
group : root
64
- mode : ' 0600 '
83
+ mode : ' 0644 '
65
84
You can’t perform that action at this time.
0 commit comments