HEX
Server: Apache/2.4.63 (Unix)
System: Linux TOMS-220NAS 4.4.302+ #86009 SMP Wed Nov 26 18:19:17 CST 2025 x86_64
User: flavio87 (1026)
PHP: 8.3.27
Disabled: NONE
Upload Files
File: /volume1/@appstore/WebStation/tools/webstation_docker_event.sh
#!/bin/bash

if [ -z "$1" ]; then
    echo "Usage: $0 event_data [json]"
    exit -1
fi


category=$(jq -r .Type <<< $1)
action=$(jq -r .Action <<< $1)

if [ $category == 'network' ] && [ $action == 'connect' ]; then
	container=$(jq -er .Actor.Attributes.container <<< $1)
	if [ $? -eq 0 ]; then
		/var/packages/WebStation/target/tools/synowebservice docker check-sync "$container"
		if [ $? -eq 0 ]; then
			/var/packages/WebStation/target/tools/synowebservice service sync
			/var/packages/WebStation/target/tools/synowebservice portal reload-backend
		fi
	fi
fi