FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit f45ee45b authored by James Nairn's avatar James Nairn
Browse files

Added notes

parent 7c72839f
No related branches found
No related tags found
1 merge request!6Testing
#!/bin/sh
# JWRN test script from within docker root
echo "jwrn3_test" > ./jwrn3_test_result
\ No newline at end of file
......@@ -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/
......@@ -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
#!/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
......@@ -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}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment