mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-23 07:56:57 +00:00
improve the script
Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
parent
d5272c0ea7
commit
e323f9770b
1 changed files with 15 additions and 23 deletions
22
readme.md
22
readme.md
|
|
@ -549,6 +549,7 @@ But anyhow, is here a guide that helps you automate the whole procedure:
|
||||||
```bash
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Stop the containers
|
||||||
docker exec -e STOP_CONTAINERS=1 nextcloud-aio-mastercontainer /daily-backup.sh
|
docker exec -e STOP_CONTAINERS=1 nextcloud-aio-mastercontainer /daily-backup.sh
|
||||||
|
|
||||||
# Below is optional if you run AIO in a VM which will shut down the VM afterwards
|
# Below is optional if you run AIO in a VM which will shut down the VM afterwards
|
||||||
|
|
@ -566,7 +567,7 @@ Afterwards apply the correct permissions with `sudo chown root:root /root/shutdo
|
||||||
1. save and close the crontab (when using nano are the shortcuts for this `Ctrl + o` -> `Enter` and close the editor with `Ctrl + x`).
|
1. save and close the crontab (when using nano are the shortcuts for this `Ctrl + o` -> `Enter` and close the editor with `Ctrl + x`).
|
||||||
|
|
||||||
|
|
||||||
**After that is in place, you should schedule a backup from your backup solution that creates a backup after AIO is shut down properly.**
|
**After that is in place, you should schedule a backup from your backup solution that creates a backup after AIO is shut down properly. Hint: If your backup runs on the same host, make sure to at least back up all docker volumes and additionally Nextclouds datadir, if it is not stored in a docker volume.**
|
||||||
|
|
||||||
**Afterwards, you can create a second script that automatically updates the containers:**
|
**Afterwards, you can create a second script that automatically updates the containers:**
|
||||||
|
|
||||||
|
|
@ -576,36 +577,27 @@ Afterwards apply the correct permissions with `sudo chown root:root /root/shutdo
|
||||||
```bash
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Please modify all variables below to your needings:
|
|
||||||
APACHE_PORT="443" # This needs to match the chosen APACHE_PORT port of AIO, e.g. 11000. By default it is 443.
|
|
||||||
|
|
||||||
########################################
|
|
||||||
# Please do NOT modify anything below! #
|
|
||||||
########################################
|
|
||||||
|
|
||||||
# Run container update once
|
# Run container update once
|
||||||
docker exec -e AUTOMATIC_UPDATES=1 nextcloud-aio-mastercontainer /daily-backup.sh
|
if ! docker exec -e AUTOMATIC_UPDATES=1 nextcloud-aio-mastercontainer /daily-backup.sh; then
|
||||||
|
|
||||||
# Wait until Watchtower is finished
|
|
||||||
while docker ps --format "{{.Names}}" | grep -q "^nextcloud-aio-watchtower$"; do
|
while docker ps --format "{{.Names}}" | grep -q "^nextcloud-aio-watchtower$"; do
|
||||||
echo "Waiting for watchtower to stop"
|
echo "Waiting for watchtower to stop"
|
||||||
sleep 30
|
sleep 30
|
||||||
done
|
done
|
||||||
|
|
||||||
# Wait until Apache is running again
|
while ! docker ps --format "{{.Names}}" | grep -q "^nextcloud-aio-mastercontainer$"; do
|
||||||
while nc -z localhost "$APACHE_PORT"; do
|
echo "Waiting for Mastercontainer to start"
|
||||||
echo "Waiting for Apache to start"
|
|
||||||
sleep 30
|
sleep 30
|
||||||
done
|
done
|
||||||
|
|
||||||
# Run container update another time to make sure that all containers are updated correctly.
|
# Run container update another time to make sure that all containers are updated correctly.
|
||||||
docker exec -e AUTOMATIC_UPDATES=1 nextcloud-aio-mastercontainer /daily-backup.sh
|
docker exec -e AUTOMATIC_UPDATES=1 nextcloud-aio-mastercontainer /daily-backup.sh
|
||||||
|
fi
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
You can simply copy and past the script into a file e.g. named `automatic-updates.sh` e.g. here: `/root/automatic-updates.sh`. Do not forget to modify the variables to your requirements!
|
You can simply copy and past the script into a file e.g. named `automatic-updates.sh` e.g. here: `/root/automatic-updates.sh`.
|
||||||
|
|
||||||
Afterwards apply the correct permissions with `sudo chown root:root /root/automatic-updates.sh` and `sudo chmod 700 /root/automatic-updates.sh`. Then you can create a cronjob that runs e.g. at `05:00` each day like this:
|
Afterwards apply the correct permissions with `sudo chown root:root /root/automatic-updates.sh` and `sudo chmod 700 /root/automatic-updates.sh`. Then you can create a cronjob that runs e.g. at `05:00` each day like this:
|
||||||
1. Open the cronjob with `sudo crontab -u root -e` (and choose your editor of choice if not already done. I'd recommend nano).
|
1. Open the cronjob with `sudo crontab -u root -e` (and choose your editor of choice if not already done. I'd recommend nano).
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue