Last active
March 27, 2022 06:38
-
-
Save drsh0/ac364ccff2aec4541cbc087c9fc1bce4 to your computer and use it in GitHub Desktop.
A script to take a backup of the existing unifi controller container and set up the desired new version. Relies on images from https://hub.docker.com/r/jacobalberty/unifi/tags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
var_date=$(date +"%Y-%m-%d") | |
read -p "I need to stop the unifi container. Do you want to proceed? y/n " -n 1 -r | |
echo | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
docker stop unifi | |
echo "unifi stopped" | |
fi | |
echo "renaming docker unifi container to unifi_"$var_date | |
docker rename unifi unifi_$var_date | |
echo | |
read -p "Would you like to upgrade the controller version? y/n " -n 1 -r | |
echo | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
read -p 'What version would you like to upgrade unifi to? Please refer to docker image tags on dockerhub eg. v7.0: ' version_selection | |
echo $version_selection | |
docker run -d \ | |
--restart=unless-stopped \ | |
--net=host \ | |
--name=unifi \ | |
-e TZ='Australia/Sydney' \ | |
-e RUNAS_UID0=false \ | |
-e UNIFI_UID=1000 \ | |
-e UNIFI_GID=1000 \ | |
-v /home/$USER/Documents/unifi/mount/unifi:/unifi \ | |
jacobalberty/unifi:$version_selection | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment