重启harbor的脚本

#!/bin/bash

WORK_DIR=/root/harbor

for STOP_COUNT_NUM in {1..10}
do
    cd $WORK_DIR
    docker-compose stop
    if [ ! $? -eq 0 ]; then
        echo " STOP  ERROR 正在进行第 $STOP_COUNT_NUM 次重启..."
        continue
    else
        break
    fi
    sleep 1
    echo "-------------------------------------------------"
done

for START_COUNT_NUM in {1..10}
do
    cd $WORK_DIR
    docker-compose start
    if [ ! $? -eq 0 ]; then
        echo " START ERROR 正在进行第 $START_COUNT_NUM 次重启..."
        continue
    else
        break
    fi
    sleep 1
    echo "-------------------------------------------------"
done

posted @ 2023-08-09 10:36  Chuyio  阅读(119)  评论(0编辑  收藏  举报