Add 24 files
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 14s
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 14s
This commit is contained in:
23
tailscale-relay/stop.sh
Executable file
23
tailscale-relay/stop.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC1091
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
_check_required_env_vars "CONTAINER_NAME"
|
||||
|
||||
echo "Stopping Tailscale Relay container..."
|
||||
|
||||
if ! lxc info "${CONTAINER_NAME}" &>/dev/null; then
|
||||
echo "Container ${CONTAINER_NAME} does not exist."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if lxc info "${CONTAINER_NAME}" 2>/dev/null | grep -q "Status: RUNNING"; then
|
||||
# Gracefully disconnect from Tailscale network before stopping
|
||||
echo "Disconnecting from Tailscale network..."
|
||||
lxc exec "${CONTAINER_NAME}" -- tailscale down 2>/dev/null || true
|
||||
sleep 2
|
||||
|
||||
lxc stop "${CONTAINER_NAME}" || _die "Failed to stop container"
|
||||
echo "Tailscale Relay container stopped."
|
||||
else
|
||||
echo "Container is not running."
|
||||
fi
|
||||
Reference in New Issue
Block a user