b5938: Parameterise scripts, make sed global, move mail

use sed g option
This commit is contained in:
Thomas Stokes committed 2023-12-21 15:28:39 +00:00
1 parent 86844bcb80
commit 08393c4f00
7 files changed
+11 -8

No files matched your search

@@ -1 +1 @@
15 12 * * * PATH_OF_GIT_HOME_DIR_TO_REPLACE/configuration/downloadNewArchivedTracTracEvents.sh /home/trac/static/TracTracTracks >PATH_OF_HOME_DIR_TO_REPLACE/downloadNewArchivedTracTracEvents.out 2>PATH_OF_HOME_DIR_TO_REPLACE/downloadNewArchivedTracTracEvents.err
15 12 * * * PATH_OF_GIT_HOME_DIR_TO_REPLACE/configuration/downloadNewArchivedTracTracEvents.sh /home/trac/static/TracTracTracks "PATH_OF_GIT_HOME_DIR_TO_REPLACE">PATH_OF_HOME_DIR_TO_REPLACE/downloadNewArchivedTracTracEvents.out 2>PATH_OF_HOME_DIR_TO_REPLACE/downloadNewArchivedTracTracEvents.err
@@ -1 +1 @@
10 12 * * * PATH_OF_GIT_HOME_DIR_TO_REPLACE/configuration/update-tractrac-urls-to-archive.sh >PATH_OF_HOME_DIR_TO_REPLACE/update-tractrac-urls-to-archive.out 2>PATH_OF_HOME_DIR_TO_REPLACE/update-tractrac-urls-to-archive.err
10 12 * * * PATH_OF_GIT_HOME_DIR_TO_REPLACE/configuration/update-tractrac-urls-to-archive.sh "PATH_OF_GIT_HOME_DIR_TO_REPLACE" >PATH_OF_HOME_DIR_TO_REPLACE/update-tractrac-urls-to-archive.out 2>PATH_OF_HOME_DIR_TO_REPLACE/update-tractrac-urls-to-archive.err
@@ -1,5 +1,7 @@
#!/bin/bash
GIT_ROOT=/home/wiki/gitwiki
/home/wiki/gitwiki
#eg /home/wiki/gitwiki
GIT_ROOT="${2}"
# Downloads all TracTrac event data based on ${GIT_ROOT}/configuration/tractrac-json-urls
# into the target directory (specified as $1) for those event URLs whose specific folder
# does not yet exist in the target directory.
@@ -1 +0,0 @@
../../crontabs/crontab-mail-events-on-my
@@ -7,7 +7,7 @@
#then construct the crontab, replacing a keyword with the user in the specification. install the crontab in the path of the user
#and then run it for the specified user.
if [[ $# -ne 3 ]]; then
echo "$0 <ENVIRONMENT_YPE> <USER_WITH_CODE> <NAME_OF_GIT_DIR>"
echo "$0 <ENVIRONMENT_TYPE> <USER_WITH_CODE> <NAME_OF_GIT_DIR>"
echo ""
echo "Where USER_WITH_CODE is a user that contains a checked out copy of the main git."
echo "And where NAME_OF_GIT_DIR is the path to the git repo from the USER_WITH_CODE's home directory."
@@ -25,6 +25,6 @@ for crontab in $(ls crontab*); do
cat "$crontab" >> $HOME_DIR/crontab
echo "" >> $HOME_DIR/crontab # Adds a newline
done
sed -i "s|PATH_OF_GIT_HOME_DIR_TO_REPLACE|${GIT_PATH}|" $HOME_DIR/crontab # Sets correct path to the git repo within the crontab.
sed -i "s|PATH_OF_HOME_DIR_TO_REPLACE|${HOME_DIR}|" $HOME_DIR/crontab # Sets the correct path to the home dir of the user whose crontab will be installed.
sed -i "s|PATH_OF_GIT_HOME_DIR_TO_REPLACE|${GIT_PATH}|g" $HOME_DIR/crontab # Sets correct path to the git repo within the crontab.
sed -i "s|PATH_OF_HOME_DIR_TO_REPLACE|${HOME_DIR}|g" $HOME_DIR/crontab # Sets the correct path to the home dir of the user whose crontab will be installed.
crontab -u $(cat USER) $HOME_DIR/crontab
@@ -0,0 +1 @@
../../crontabs/crontab-mail-events-on-my
@@ -1,5 +1,6 @@
#!/bin/bash
GIT_ROOT=/home/wiki/gitwiki
#eg /home/wiki/gitwiki
GIT_ROOT=$1
PATH_TO_TRAC_TRAC_URLS="configuration/tractrac-json-urls"
urls=$(mongo --quiet "mongodb://dbserver.internal.sapsailing.com:10201/winddb?replicaSet=archive" --eval 'db.TRACTRAC_CONFIGURATIONS.find({}, {TT_CONFIG_JSON_URL : 1}).toArray()' | grep -v ObjectId | jq -r '.[].TT_CONFIG_JSON_URL' )
if [[ $urls == "null" ]]; then