new: [zato] Add actions to start, stop and restart Zato

This commit is contained in:
Boris Gallet
2024-10-22 16:23:27 +02:00
parent 74c28a1bb6
commit 06c91d245f
4 changed files with 92 additions and 2 deletions

25
zato/actions/restart-zato Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
if [ -z "$SERVICE_DATASTORE" ]; then
echo "This script is meant to be run through 'compose' to work properly." >&2
exit 1
fi
. "$CHARM_PATH/lib/common"
# Combined commands to be run as zato user
local zato_commands="
/opt/zato/current/bin/zato stop /opt/zato/env/qs-1/server1/ &&
cd /opt/zato/env/qs-1 &&
./start-server-fg.sh &
"
# Execute commands as zato user
if ! exec_as_zato_in_container "$zato_commands"; then
printf "Error: Failed to execute zato commands in container '%s'.\n" "$CONTAINER_NAME" >&2
return 1
fi
printf "Zato restarted successfully in container '%s'.\n" "$CONTAINER_NAME" >&2