39 lines
1.0 KiB
Bash
Executable File
39 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
SCRIPTHOME=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
|
|
secho() {
|
|
for ((i=0;i<$1;i++)); do echo ""; done
|
|
echo $2
|
|
}
|
|
|
|
sudo echo -n ""
|
|
if [ $(whoami) = "root" ]; then
|
|
echo "sudo せずに実行してください"
|
|
exit 0
|
|
fi
|
|
|
|
cd $SCRIPTHOME/backup
|
|
|
|
echo "=== docker-compose.ymlの書き換え"
|
|
sed -i "s/DO_BACKUP: .*/DO_BACKUP: \"restore\"/g" docker-compose.yml
|
|
|
|
secho 3 "=== kopano, gitea, rordbコンテナの停止"
|
|
sudo docker container stop kopano gitea rordb
|
|
|
|
secho 3 "=== バックアップコンテナの起動"
|
|
sudo docker compose up -d --build
|
|
sudo docker attach backup
|
|
|
|
secho 3 "=== バックアップコンテナの削除"
|
|
sudo docker compose down
|
|
|
|
secho 3 "=== kopano, gitea, rordbコンテナの起動"
|
|
sudo docker container start kopano gitea rordb
|
|
|
|
echo "=== docker-compose.ymlの書き戻し"
|
|
sed -i "s/DO_BACKUP: .*/DO_BACKUP: \"true\"/g" docker-compose.yml
|
|
|
|
secho 3 "=== リストア完了(&SCRIPTHOME/backup/backups)"
|
|
echo "git.example.netにSSHで接続するには公開鍵を登録し直してください"
|
|
exit
|