From f45ee45bfec6aeffe6a5f4e957f90cb96e45f26f Mon Sep 17 00:00:00 2001 From: James Nairn <jwrn3@cam.ac.uk> Date: Tue, 26 May 2020 09:54:36 +0100 Subject: [PATCH] Added notes --- jwrn3_test.sh | 4 --- notes.txt | 15 +++++------ starting-pack.sh | 4 +-- test.sh | 66 ----------------------------------------------- weekly_routine.sh | 2 +- 5 files changed, 9 insertions(+), 82 deletions(-) delete mode 100644 jwrn3_test.sh delete mode 100755 test.sh diff --git a/jwrn3_test.sh b/jwrn3_test.sh deleted file mode 100644 index 877fe0a..0000000 --- a/jwrn3_test.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -# JWRN test script from within docker root -echo "jwrn3_test" > ./jwrn3_test_result \ No newline at end of file diff --git a/notes.txt b/notes.txt index ab61f42..2709d87 100644 --- a/notes.txt +++ b/notes.txt @@ -2,16 +2,13 @@ Notes canto-space = /data/export/canto/canto - -OnCalendar=Mon 01:00:00 - +Systemd Copy files to /etc/systemd/system/ sudo systemctl start canto_weekly.timer -Working - -Is ssh passwordless set up for root? - No -Shuold weekly run as root or another user? +systemctl stop canto -Provide ssh ppublic key for fbadmin on deneb +Repository +https://gitlab.developers.cam.ac.uk/jwrn3/pdn-canto-config -https://gitlab.developers.cam.ac.uk/jwrn3/pdn-canto-config \ No newline at end of file +# Rsync from repo to canto-space +rsync -av /data/export/canto-space/pdn-canto-config/ /data/export/canto-space/ diff --git a/starting-pack.sh b/starting-pack.sh index 745308b..4d4bd29 100644 --- a/starting-pack.sh +++ b/starting-pack.sh @@ -17,7 +17,7 @@ cp canto-docker-initd /sbin/ chmod a+x /sbin/canto-docker-initd cp canto-docker-initd ./canto/etc/ chmod a+x ./canto/etc/canto-docker-initd -rm canto-docker-initd +#rm canto-docker-initd ##create a 'canto' file @ /etc/init.d ##and make it executable @@ -45,6 +45,6 @@ done #run the weekly routine script which executes all configuration steps -sh weekly_routine.sh +# sh weekly_routine.sh diff --git a/test.sh b/test.sh deleted file mode 100755 index 63f87bf..0000000 --- a/test.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh - -# Called if total failure happens -function fail { - # Echo output to stderr - echo "${1}" >&2 - - # Exit with non-zero code - exit 1 -} - -function retry { - # Define local vars - - # Starting number - local n=1 - - # Max number of attempts - local max=5 - - # Sleep period in seconds until retry - local delay=2 - - # Loop - while true; do - - # Run array of commands passed in and break loop if successful - "${@}" && break || { - - # Else loop while attempt no is less than max - if [[ "${n}" -lt "${max}" ]]; then - - # Increment attempt counter - ((n++)) - - # echo status - echo "Command failed. Attempt ${n}/${max}" - - # Sleep for period - sleep ${delay} - else - # Hit max attempts and still failed so giving up - fail "The command has failed after ${n} attempts." - fi - } - done -} - -# Grab file from Daneb -FILENAME="marker_file.txt" - -retry scp jwrn3@ent.csi.cam.ac.uk:"${FILENAME}" /tmp/ - -# Get DBNAME from downloaded file -if [[ -e "/tmp/${FILENAME}" ]]; then - DBNAME=$(cat "/tmp/${FILENAME}") -fi - -# Check DBNAME is not blank -if [[ -z ${BDNAME }]]; then - echo "${DBNAME} is blank, cannot continue" - exit 1 -fi - -# Transform $DBNAME -sed -E "s/(^[[:space:]]+\-[[:space:]]\"dbi\:Pg\:dbname=)[[:alpha:]]+(\;[[:space:]]host=deneb\.pdn\.cam\.ac\.uk\")/\1${DBNAME}\2/" canto_deployment.yaml \ No newline at end of file diff --git a/weekly_routine.sh b/weekly_routine.sh index bca7943..8595187 100644 --- a/weekly_routine.sh +++ b/weekly_routine.sh @@ -144,7 +144,7 @@ if [[ -z ${BDNAME } ]]; then fi # Transform $DBNAME -CANTO_CONFIG="./canto_deploy.yaml" +CANTO_CONFIG=".canto/canto_deploy.yaml" if [[ -e "${CANTO_CONFIG}" ]]; then sed -i.bak -E "s/(^[[:space:]]+\-[[:space:]]\"dbi\:Pg\:dbname=)[[:alpha:]]+(\;[[:space:]]host=deneb\.pdn\.cam\.ac\.uk\")/\1${DBNAME}\2/" "${CANTO_CONFIG}" -- GitLab