Skip to content

Commit d858254

Browse files
committed
Use ssh instead of wget to fetch the dmp file
- as the dmp file will soon reside on a host without a webserver
1 parent 640f43d commit d858254

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ This repo contains the service and cron scripts used to run a failover gocdb ins
2828
|_ dropGocdbUser.sh # Drops the current DB schema
2929
|_ loadData.sh # Load the last successfully downloaded DB dmp into the RDBMS
3030
|_ gatherStats.sh # Oracle gathers stats to re-index
31-
|_ pass_wgetrc_exemplar.txt # Sample pwd file for getDump.sh (rename to pass_wgetrc)
3231
|_ pass_file_exemplar.txt # Sample pwd file for DB (rename to pass_file)
3332
3433
nsupdate_goc/ # Scripts for switching the DNS to the failover
@@ -71,10 +70,11 @@ cron:
7170
/root/importDBdmpFile/1_runDbUpdate.sh
7271
```
7372

74-
You will also need to modify the two password files to specify
75-
your own pw ('pass_wgetrc' and 'pass_file'). These contain the
76-
pw for the secure download of dmp file and the pw of the DB
77-
system user.
73+
You will also need to:
74+
* generate a public/private key pair using `ssh-keygen` and ensure the public
75+
key is present on the host with the database dmp file.
76+
* populate `importDBdmpFile/failover_TEMPLATE.sh` with
77+
appropriate values and copy it to `/etc/gocdb/failover.sh`
7878

7979
## /root/nsupdate_goc/
8080
Contains the nsupdate keys and nsupdate scripts for switching

importDBdmpFile/failover_TEMPLATE.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file is a template for /etc/gocdb/failover.sh.
2+
# Copy this file to that location and set the variables as appropriate.
3+
4+
# Set the user@host:path to copy the DB dump file from.
5+
DB_DUMP_FROM=user@hostname:/path/to/db/dump
6+
7+
# Set the local location to copy the DB dump file to.
8+
DB_DUMP_TO=/tmp

importDBdmpFile/getDump.sh

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
#!/bin/bash
22

3-
# seems that curl don't return a 0 exit code when it fails to download successfully, see:
4-
# http://superuser.com/questions/590099/can-i-make-curl-fail-with-an-exitcode-different-than-0-if-the-http-status-code-i
5-
#
6-
#curl --capath /etc/grid-security/certificates -u failover:kugA7Rer https://goc.egi.eu/dbDump/goc5dump.dmp -o /tmp/goc5dump.dmp
3+
# Set some things that cause this script to exit on a failure,
4+
# rather than carry on blindly.
5+
# -e Exit on any error
6+
# -u Classify unset variables as errors
7+
set -eu
78

8-
# therefore use wget which does return 0 exit code if downloaded ok
9-
# /usr/bin/wget -O /tmp/goc5dump.dmp --user failover --password u_LK28_B2fv_dm --no-check-certificate https://goc.egi.eu/dbDump/goc5dump.dmp
9+
# Get useful variables to refer to later in this script.
10+
source /etc/gocdb/failover.sh
1011

11-
DUMPDIR=/tmp
12-
BASEDIR=/root/importDBdmpFile
12+
# Copy the DB dump file.
13+
/usr/bin/scp $DB_DUMP_FROM $DB_DUMP_TO
1314

14-
export WGETRC=$BASEDIR/pass_wgetrc
15-
16-
/usr/bin/wget --no-check-certificate \
17-
--ca-directory /etc/grid-security/certificates \
18-
-O $DUMPDIR/goc5dump.dmp \
19-
https://goc.egi.eu/dbDump/goc5dump.dmp
15+
# unset things to not affect the rest of the Failover process.
16+
set +eu

importDBdmpFile/pass_wgetrc_exemplar.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)