fixes
This commit is contained in:
@@ -1,14 +1,55 @@
|
||||
this script gets a container UUID
|
||||
#!/bin/bash
|
||||
# Usage: ./start_by_uuid.sh <uuid>
|
||||
# Example: ./start_by_uuid.sh abc-001-xxxx-xxxx-xxxx
|
||||
|
||||
Wtrite a bash script, that gets all info out off the Sqlite3 Database usind the UUID and stores the values in environment variables
|
||||
DB_PATH="/4server/data/contracts.db"
|
||||
BIN_PATH="/4server/sbin"
|
||||
|
||||
setr the BIN_BATH to /4srver/sbin/
|
||||
UUID="$1"
|
||||
|
||||
the uuid looks like xxx-xxx-xxxx-xxxx-xxxx-....
|
||||
if [[ -z "$UUID" ]]; then
|
||||
echo "Usage: $0 <uuid>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
get the second number
|
||||
# Fetch all info from SQLite and export as environment variables
|
||||
eval $(sqlite3 -separator "=" "$DB_PATH" \
|
||||
"SELECT 'UUID=' || UUID,
|
||||
'EMAIL=' || email,
|
||||
'EXPIRES=' || expires,
|
||||
'TAGS=' || tags,
|
||||
'ENV=' || env,
|
||||
'AFFILIATE=' || affiliate,
|
||||
'IMAGE=' || image,
|
||||
'HISTORY=' || history,
|
||||
'COMMENT=' || comment,
|
||||
'DOMAINS=' || domains,
|
||||
'STATUS=' || status,
|
||||
'CREATED=' || created,
|
||||
'BUMP=' || bump
|
||||
FROM containers WHERE UUID='$UUID';" | sed 's/ /\\ /g')
|
||||
|
||||
# Debug: print loaded environment variables
|
||||
# env | grep -E 'UUID|EMAIL|EXPIRES|TAGS|ENV|AFFILIATE|IMAGE|HISTORY|COMMENT|DOMAINS|STATUS|CREATED|BUMP'
|
||||
|
||||
# Extract the second part of UUID (split by "-")
|
||||
SECOND_PART=$(echo "$UUID" | cut -d'-' -f2)
|
||||
|
||||
# Decide which script to run
|
||||
case "$SECOND_PART" in
|
||||
001)
|
||||
"$BIN_PATH/start/n8n"
|
||||
;;
|
||||
002)
|
||||
"$BIN_PATH/start/ODOO18"
|
||||
;;
|
||||
003)
|
||||
"$BIN_PATH/start/ODOO19"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown UUID type: $SECOND_PART"
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
When the number is 001 call the script BIN_PATH/start/n8n
|
||||
When the number is 002 call the sctipr BIN_ÜATH/start/ODOO18
|
||||
WHen the number is 003 call the script BIN_PATH/start/ODOO19
|
||||
|
||||
|
||||
Reference in New Issue
Block a user