-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimplebackup.sh
51 lines (43 loc) · 999 Bytes
/
simplebackup.sh
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
#!/bin/sh
#
# Simple Backup Script
# (c) Sebastian Muszytowski
#
# Please see README for detailed instructions
## CONFIGURATION ##
date="$(date +%Y.%m.%d-%k.%M)"
backupdir=/path/to/backupdir
host="user@host.tld"
# Attention:
# If you have a trailing / in backupdir then please delete the / below
mkdir ${backupdir}/${date}
newdir= ${backupdir}/${date}
tarcmd="tar -czf -"
extension=".tar.gz" # .tgz is also possible
## END OF CONFIGURATION PATH ##
##
# Backup process
##
# -> PostgreSQL
##
ssh ${host} "su postgres -c pg_dumpall" >> ${newdir}/postgres.sql
##
# -> OpenLDAP
##
ssh ${host} slapcat >> ${newdir}/openldap
##
# -> Cronjobs (/var/spool/cron)
##
ssh ${host} "${tarcmd} /var/spool/cron" >> ${newdir}/crontab${extension}
##
# -> /etc/
##
ssh ${host} "${tarcmd} /etc/" >> ${newdir}/etc${extension}
##
# -> /var/spool/mail
##
ssh ${host} "${tarcmd} /var/spool/mail" >> ${newdir}/mails${extension}
##
# -> /var/www/
##
ssh ${host} "${tarcmd} /var/www" >> ${newdir}/www${extension}