Update 'root/usr/libexec/apps/nodered/nodered.sh'

main
ben 1 year ago
parent 427b4a24ec
commit bd68d11f48

@ -70,12 +70,14 @@ usage() {
case ${ACTION} in case ${ACTION} in
"install") "install")
get_image()
do_install_detail do_install_detail
;; ;;
"upgrade") "upgrade")
docker-compose -f /opt/docker2/compose/nodered-app/docker-compose.yml up -d docker-compose -f /opt/docker2/compose/nodered-app/docker-compose.yml up -d
;; ;;
"rm") "rm")
APP_NAME="nodered"
IMAGE_NAME=$(uci get nodered.@nodered[0].image_name 2>/dev/null) IMAGE_NAME=$(uci get nodered.@nodered[0].image_name 2>/dev/null)
CONTAINER_IDS=$(docker ps -a --filter "ancestor=${APP_NAME}" --format '{{.ID}}') CONTAINER_IDS=$(docker ps -a --filter "ancestor=${APP_NAME}" --format '{{.ID}}')
echo "Stopping and removing containers..." echo "Stopping and removing containers..."
@ -86,16 +88,19 @@ case ${ACTION} in
docker rmi -f $IMAGE_NAME docker rmi -f $IMAGE_NAME
;; ;;
"start"|"stop"|"restart") "start"|"stop"|"restart")
APP_NAME="nodered"
CONTAINER_IDS=$(docker ps -a --filter "ancestor=${APP_NAME}" --format '{{.ID}}') CONTAINER_IDS=$(docker ps -a --filter "ancestor=${APP_NAME}" --format '{{.ID}}')
for ID in $CONTAINER_IDS; do for ID in $CONTAINER_IDS; do
docker ${ACTION} ${ID} docker ${ACTION} ${ID}
done done
;; ;;
"status") "status")
APP_NAME="nodered"
CONTAINER_NAMES=$(docker ps -a --filter "ancestor=${APP_NAME}" --format '{{.Names}}') CONTAINER_NAMES=$(docker ps -a --filter "ancestor=${APP_NAME}" --format '{{.Names}}')
docker ps --all -f "name=${CONTAINER_NAMES}" --format '{{.Status}}' docker ps --all -f "name=${CONTAINER_NAMES}" --format '{{.Status}}'
;; ;;
"port") "port")
APP_NAME="nodered"
CONTAINER_NAMES=$(docker ps -a --filter "ancestor=${APP_NAME}" --format '{{.Names}}') CONTAINER_NAMES=$(docker ps -a --filter "ancestor=${APP_NAME}" --format '{{.Names}}')
docker ps --all -f "name=${CONTAINER_NAMES}" --format '{{.Ports}}' | grep -om1 '0.0.0.0:[0-9]*' | sed 's/0.0.0.0://' docker ps --all -f "name=${CONTAINER_NAMES}" --format '{{.Ports}}' | grep -om1 '0.0.0.0:[0-9]*' | sed 's/0.0.0.0://'
;; ;;

Loading…
Cancel
Save