FAQ
| This is a
LIVE
service |
Changelog
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backup-scheduler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab has been upgraded. See what's new in the
Changelog
.
Show more breadcrumbs
Yusuf Hamied Department of Chemistry
COs
backup-scheduler
Commits
de3a7f6f
Commit
de3a7f6f
authored
7 years ago
by
Dr Catherine Pitt
Browse files
Options
Downloads
Patches
Plain Diff
Add prepare script that does not dump mysql or postgres
parent
04e7b9a0
No related branches found
Branches containing commit
Tags
0.9-ch73
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ROOT/DEBIAN/control
+1
-1
1 addition, 1 deletion
ROOT/DEBIAN/control
ROOT/etc/chem-zfs-backup-server/zfs-rsync.d/prepare-ignore-mysql-and-postgres
+67
-0
67 additions, 0 deletions
...ckup-server/zfs-rsync.d/prepare-ignore-mysql-and-postgres
with
68 additions
and
1 deletion
ROOT/DEBIAN/control
+
1
−
1
View file @
de3a7f6f
...
...
@@ -3,7 +3,7 @@ Priority: optional
Section: otherosfs
Maintainer: Frank Lee <rl201@cam.ac.uk>
Architecture: all
Version: 0.9-ch4
6
Version: 0.9-ch4
7
Depends: zfs-dkms, postgresql, liblockfile-simple-perl, libdbi-perl, libjson-perl, libzfs-perl-chem, libnet-openssh-perl, libdbd-pg-perl, mbuffer, rsync, nfs-kernel-server, pv
Description: a backup system using ZFS
Ported (well, mostly) from FreeBSD to a Sane OS.
This diff is collapsed.
Click to expand it.
ROOT/etc/chem-zfs-backup-server/zfs-rsync.d/prepare-ignore-mysql-and-postgres
0 → 100755
+
67
−
0
View file @
de3a7f6f
#!/bin/bash
# A script which runs, largely on the remote machine, to prepare for backup
# Jobs to do:
# * Exclude files which are only found in packages
# * List all packages which are installed
# * (optionally) dump PostgreSQL into a file
# NB this is intended to be used in conjunction with a separate mysql backup
# task. To do this:
# 1) /usr/lib/chem-zfs-backup-server/new-backup-rsync $HOSTNAME mysql
# 2) add "--exclude=/var/lib/mysql --exclude=/var/lib/mysql-files" to
# to zfs-rsync.d config for $HOSTNAME
CONFDIR
=
/etc/chem-zfs-backup-server/zfs-rsync.d
SSH
=
"ssh -p
${
SSHPORT
:-
22
}
-o ConnectTimeout=10"
SCP
=
"scp -P
${
SSHPORT
:-
22
}
"
#echo $SSH
set
-xv
SERVER
=
$1
if
[
-z
$SERVER
]
;
then
echo
$0
Server
exit
1
fi
(
# Has the package status changed since last time we generated the list of files?
if
$SSH
root@
$SERVER
[
/var/lib/dpkg/status
-nt
/var/adm/backup/package-files
]
;
then
# Need to rebuild package-files
$SSH
root@
$SERVER
"
umask 077
FILELIST=
\`
tempfile
\`
CONFLIST=
\`
tempfile
\`
mkdir -p /var/adm/backup
# Make logrotate use datestamps
if ! grep -q dateext /etc/logrotate.conf ; then sed -i 's/^include/dateext
\n
include/' /etc/logrotate.conf ; fi
# Which packages are installed?
dpkg --get-selections | awk ' { print
\$
1 ; } ' >/var/adm/backup/packages
cat /var/lib/dpkg/info/*.list | while read F ; do [ -f
\"\$
F
\"
] && echo
\"\$
F
\"
; done | sort >
\$
FILELIST
awk '/Description:/ { flag = 0 } ; flag == 1 { print
\$
1 ; } ; /Conffiles:/ { flag = 1 } ; ' </var/lib/dpkg/status | sort >
\$
CONFLIST
diff -u
\$
FILELIST
\$
CONFLIST | grep ^-/ | sed s/^-// >/var/adm/backup/package-files
rm
$FILELIST
$CONFLIST
"
mkdir
-p
$CONFDIR
/
$SERVER
$SCP
-q
root@
$SERVER
:/var/adm/backup/package-files
$CONFDIR
/
$SERVER
/exclude
fi
# Ensure that the excludes file exists, even if we haven't updated it this time
if
[
!
-f
$CONFDIR
/
$SERVER
/exclude
]
;
then
mkdir
-p
$CONFDIR
/
$SERVER
$SCP
-q
root@
$SERVER
:/var/adm/backup/package-files
$CONFDIR
/
$SERVER
/exclude
fi
$SSH
root@
$SERVER
"
# Ensure that things are not readable where they ought not to be
umask 077
# Save the package configuration info
which debconf-get-selections >/dev/null 2>&1 || apt-get install debconf-utils
which rsync >/dev/null 2>&1 || apt-get install rsync
debconf-get-selections >/var/adm/backup/debconf
# Dump LDAP, if we can
which slapcat >/dev/null 2>&1 && slapcat >/var/adm/backup/ldap
# Ignore exit status of this command
true
"
echo
Prepared
$SERVER
`
date
`
)
>
/var/log/chem-zfs-backup-server/
${
SERVER
}
-prepare
2>&1
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment