Move run files to run directory.

This commit is contained in:
yohan 2024-03-03 17:58:17 +01:00
parent f0466fcb34
commit 28872f7f25
2 changed files with 20 additions and 5 deletions

View File

@ -7,8 +7,8 @@ services:
restart: always restart: always
network_mode: "host" network_mode: "host"
volumes: volumes:
- ./crontab.yaml:/root/crontab.yaml:Z - ${RUN_DIRECTORY}/crontab.yaml:/root/crontab.yaml:Z
- ./id_rsa:/root/.ssh/id_rsa:Z - ${RUN_DIRECTORY}/id_rsa:/root/.ssh/id_rsa:Z
- ./id_rsa.pub:/root/.ssh/id_rsa.pub:Z - ${RUN_DIRECTORY}/id_rsa.pub:/root/.ssh/id_rsa.pub:Z
- ./config:/root/.ssh/config:Z - ${RUN_DIRECTORY}/config:/root/.ssh/config:Z
- ./scripts:/root/scripts:Z - ${RUN_DIRECTORY}/scripts:/root/scripts:Z

View File

@ -1,5 +1,19 @@
#!/bin/bash #!/bin/bash
#Absolute path to this script
SCRIPT=$(readlink -f $0)
#Absolute path this script is in
SCRIPTPATH=$(dirname $SCRIPT)
STACK=$(basename "$SCRIPTPATH")
export RUN_DIRECTORY="/usr/local/docker-mounted-files/${STACK}"
cd "$SCRIPTPATH"
source vars source vars
sudo mkdir -p "${RUN_DIRECTORY}"
sudo chmod a+rx "${RUN_DIRECTORY}"
sudo cp config "${RUN_DIRECTORY}"
cd "${RUN_DIRECTORY}"
test -z $KEY && { echo "KEY is not defined."; exit 1; } test -z $KEY && { echo "KEY is not defined."; exit 1; }
test -z $1 || HOST="_$1" test -z $1 || HOST="_$1"
test -z $2 || INSTANCE="_$2" test -z $2 || INSTANCE="_$2"
@ -21,6 +35,7 @@ sudo chown root. crontab.yaml id_rsa id_rsa.pub config scripts
sudo chmod 644 crontab.yaml sudo chmod 644 crontab.yaml
sudo chmod 400 id_rsa id_rsa.pub config sudo chmod 400 id_rsa id_rsa.pub config
cd "$SCRIPTPATH"
unset VERSION_CRON unset VERSION_CRON
export VERSION_CRON=$(git ls-remote https://${GIT_SERVER}/yohan/docker-cron.git| head -1 | cut -f 1|cut -c -10) export VERSION_CRON=$(git ls-remote https://${GIT_SERVER}/yohan/docker-cron.git| head -1 | cut -f 1|cut -c -10)