working
This commit is contained in:
@@ -38,7 +38,7 @@ echo "=================================================="
|
|||||||
# -----------------------------
|
# -----------------------------
|
||||||
|
|
||||||
check_and_create_db() {
|
check_and_create_db() {
|
||||||
|
echo "check and create"
|
||||||
echo "Connecting as $POSTGRES_ADMIN_USER to $POSTGRES_HOST:$POSTGRES_PORT"
|
echo "Connecting as $POSTGRES_ADMIN_USER to $POSTGRES_HOST:$POSTGRES_PORT"
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export PATH=/4PROJECTS/bin:$PATH
|
export PATH=/4PROJECTS/bin:$PATH
|
||||||
|
|
||||||
if [ ! -n "$2" ]; then
|
if [ ! -n "$2" ]; then
|
||||||
echo "Missing Parameters <UUID> <FILE>"
|
echo "Missing Parameters <UUID> <FILE>"
|
||||||
exit 0
|
exit 0
|
||||||
@@ -10,23 +9,24 @@ UUID=$1
|
|||||||
|
|
||||||
source /4server/sbin/helpers
|
source /4server/sbin/helpers
|
||||||
|
|
||||||
docker run $UUID
|
echo "Restoring $FILENAME to $1"
|
||||||
|
echo "status of container"
|
||||||
|
doas docker ps -a --filter "id=$UUID"
|
||||||
|
|
||||||
BACKUP="/mnt/backup/$2"
|
BACKUP="/mnt/backup/$2"
|
||||||
TEMPLATE="/mnt/db_images/$2"
|
TEMPLATE="/mnt/db_images/$2"
|
||||||
echo "TEMPLATE"
|
echo "TEMPLATE"
|
||||||
docker exec "${1%}" /bin/bash -c "[ -f $TEMPLATE ]"
|
doas docker exec "${1%}" /bin/bash -c "[ -f $TEMPLATE ]"
|
||||||
|
|
||||||
if docker exec "${1%}" /bin/bash -c "[ -f $BACKUP ]"; then
|
if doas docker exec "${1%}" /bin/bash -c "[ -f $BACKUP ]"; then
|
||||||
FILENAME="$BACKUP"
|
FILENAME="$BACKUP"
|
||||||
elif docker exec "${1%}" /bin/bash -c "[ -f $TEMPLATE ]"; then
|
elif doas docker exec "${1%}" /bin/bash -c "[ -f $TEMPLATE ]"; then
|
||||||
FILENAME="$TEMPLATE"
|
FILENAME="$TEMPLATE"
|
||||||
else
|
else
|
||||||
echo "File not exists"
|
echo "File not exists"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Restoring $FILENAME to $1"
|
|
||||||
|
|
||||||
### DELETE DATABASE
|
### DELETE DATABASE
|
||||||
PGPASSWORD="$POSTGRES_ADMIN_PASSWORD" psql \
|
PGPASSWORD="$POSTGRES_ADMIN_PASSWORD" psql \
|
||||||
@@ -36,20 +36,20 @@ PGPASSWORD="$POSTGRES_ADMIN_PASSWORD" psql \
|
|||||||
|
|
||||||
|
|
||||||
echo "deleting old restore artifacts"
|
echo "deleting old restore artifacts"
|
||||||
docker exec "${1%}" rm -rf /root/.local/
|
doas docker exec "${1%}" rm -rf /root/.local/
|
||||||
|
|
||||||
if [[ "$1" == *"_"* ]]; then
|
if [[ "$1" == *"_"* ]]; then
|
||||||
echo "Neutralize DB"
|
echo "Neutralize DB"
|
||||||
docker exec "${1%_}" odoo db --db_host beedb -w "${1%_}" -r "$1" load "$1" $FILENAME -f --neutralize
|
doas docker exec "${1%_}" odoo db --db_host beedb -w "${1%_}" -r "$1" load "$1" $FILENAME -f --neutralize
|
||||||
else
|
else
|
||||||
echo "No Neutralize DB"
|
echo "No Neutralize DB"
|
||||||
docker exec "${1%}" odoo db --db_host beedb -w "${1%_}" -r "$1" load "$1" $FILENAME -f
|
doas docker exec "${1%}" odoo db --db_host beedb -w "${1%_}" -r "$1" load "$1" $FILENAME -f
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
docker exec "${1%}" cp -r /root/.local/. /var/lib/odoo/.local/
|
doas docker exec "${1%}" cp -r /root/.local/. /var/lib/odoo/.local/
|
||||||
docker exec "${1%}" chown -R odoo:odoo /var/lib/odoo/.local/
|
doas docker exec "${1%}" chown -R odoo:odoo /var/lib/odoo/.local/
|
||||||
|
|
||||||
### transfer ownership
|
### transfer ownership
|
||||||
PGPASSWORD="$POSTGRES_ADMIN_PASSWORD" psql \
|
PGPASSWORD="$POSTGRES_ADMIN_PASSWORD" psql \
|
||||||
|
|||||||
@@ -31,9 +31,6 @@ HUGO_DIR="$BASEURL/git-server/local/hugo"
|
|||||||
|
|
||||||
SERVER_IP=$(ip -4 addr show eth0 | awk '/inet/ {print $2}' | cut -d/ -f1)
|
SERVER_IP=$(ip -4 addr show eth0 | awk '/inet/ {print $2}' | cut -d/ -f1)
|
||||||
|
|
||||||
dump_config
|
|
||||||
|
|
||||||
|
|
||||||
DOMAIN_LABEL=$(check_domains "$UUID.odoo4projects.com" "$SERVER_IP")
|
DOMAIN_LABEL=$(check_domains "$UUID.odoo4projects.com" "$SERVER_IP")
|
||||||
DOMAIN_LABEL="traefik.http.routers.$UUID.rule=Host(\`$UUID.odoo4projects.com\`)"
|
DOMAIN_LABEL="traefik.http.routers.$UUID.rule=Host(\`$UUID.odoo4projects.com\`)"
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ command_args=""
|
|||||||
pidfile="/run/${RC_SVCNAME}.pid"
|
pidfile="/run/${RC_SVCNAME}.pid"
|
||||||
command_background="yes"
|
command_background="yes"
|
||||||
|
|
||||||
|
respawn_delay=5 # seconds to wait before restart
|
||||||
|
respawn_max=0 # 0 = unlimited restarts
|
||||||
|
|
||||||
# Load environment variables if needed
|
# Load environment variables if needed
|
||||||
if [ -f /etc/4server ]; then
|
if [ -f /etc/4server ]; then
|
||||||
. /etc/4server
|
. /etc/4server
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user