Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
550c3a86
Commit
550c3a86
authored
15 years ago
by
kohleman
Browse files
Options
Downloads
Patches
Plain Diff
Initial check in
SVN: 12686
parent
e496fdc7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openbis_all/source/bash/createOpenBISBackup_general.sh
+40
-0
40 additions, 0 deletions
openbis_all/source/bash/createOpenBISBackup_general.sh
with
40 additions
and
0 deletions
openbis_all/source/bash/createOpenBISBackup_general.sh
0 → 100755
+
40
−
0
View file @
550c3a86
#! /bin/bash
# Creates a snapshot of the openbis database
# 2009, John Ryan, Manuel Kohler D-BSSE
export
BACKUP_DIR
=
~/db_backups
export
DATE
=
`
/bin/date +%Y-%m-%d_%H%M
`
export
DAYS_TO_RETAIN
=
3
export
DATABASES
=
$1
export
MAIL_LIST
=
"manuel.kohler@bsse.ethz.ch"
export
BOX
=
`
uname
-n
`
export
PLATFORM
=
`
uname
-s
`
if
[
-z
"
${
DATABASES
}
"
]
;
then
export
DATABASES
=
openbis_productive
fi
if
[
$PLATFORM
=
"SunOS"
]
;
then
export
POSTGRES_BIN
=
/usr/postgres/8.4-community/bin/
export
MAILX
=
"/usr/bin/mailx"
else
export
POSTGRES_BIN
=
/usr/bin
export
MAILX
=
"/bin/mailx"
fi
umask
077
echo
"* Creating snapshot of productive databases at
$DATE
"
for
DATABASE
in
$DATABASES
;
do
$POSTGRES_BIN
/pg_dump
-Fc
$DATABASE
>
$BACKUP_DIR
/
${
DATE
}
_
$DATABASE
-db
.dmp
if
[
$?
-ne
0
]
;
then
echo
-e
"Postgres DB backup broken ... :-("
|
$MAILX
-s
"Backup from
$BOX
for
$DATABASE
is BROKEN !"
$MAIL_LIST
else
echo
-e
"Postgres DB backup ran OK on
$BOX
for
$DATABASE
:-)"
|
$MAILX
-s
"Backup from
$BOX
for
$DATABASE
ran OK"
$MAIL_LIST
fi
done
/usr/bin/find
$BACKUP_DIR
-type
f
-mtime
+
$DAYS_TO_RETAIN
-exec
rm
{}
\;
echo
" ** Finished ** "
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