linuxtool/Config/Automation/Installs/up-docker_compose.sh
2024-09-26 10:53:51 +08:00

21 lines
435 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
declare path="$1"
if ! command -v docker &> /dev/null; then
echo "docker未安装"
exit
fi
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