#!/usr/bin/env bash # Upgrade CODE Docker code() { docker pull collabora/code:latest | grep 'Image is up to date' && pulled='no' || pulled='yes' if [[ "$pulled" = "yes" ]]; then echo "$(date +%+4Y-%m-%d): Update" >> $logfile_path docker stop CODE docker rm CODE docker run --name 'CODE' -t -d -p 9980:9980 -e 'domain=cloud\\.kto\\.black' --network host --restart always collabora/code else echo "$(date +%+4Y-%m-%d): No update" >> $logfile_path fi } # Variables logfile_path='/home/alex/docker-upgrade.log' set -ex code exit 0