2024-09-23 02:44:39 +08:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
declare path="$1"
|
|
|
|
|
if ! command -v docker &> /dev/null; then
|
|
|
|
|
echo "docker未安装"
|
|
|
|
|
exit
|
|
|
|
|
fi
|
2024-09-23 16:47:48 +08:00
|
|
|
|
|
2024-09-23 02:44:39 +08:00
|
|
|
|
declare web_path
|
|
|
|
|
read -p "请输入数据目录,默认 /var/www :" web_path
|
|
|
|
|
if [[ -z ${web_path} ]];then
|
|
|
|
|
web_path='/var/www'
|
|
|
|
|
fi
|
|
|
|
|
cat > "${path}/up-docker_compose.sh" << EOF
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
for dir in "${web_path}"/*/; do
|
|
|
|
|
cd "\$dir" || exit
|
|
|
|
|
sudo docker compose pull
|
|
|
|
|
sudo docker compose up -d
|
|
|
|
|
done
|
|
|
|
|
EOF
|