gitea/scripts/systemd/upgrade

24 lines
487 B
Plaintext
Raw Permalink Normal View History

#!/bin/bash
declare OPTARG
declare OPTION
declare OPTIND=0
Saved=("$*")
while getopts 'fg:itud:' OPTION; do
case "$OPTION" in
*) ;;
esac
done
shift $(( $OPTIND - 1 ))
Instance=$1
[[ ! $1 ]] && echo warning no instance supplied using default && Instance=default
DIR="$(dirname "$BASH_SOURCE")"
$DIR/stop $Instance
echo saved opts $Saved
$(dirname "$DIR")/upgrade $Saved
[[ $? -eq 0 ]] && $DIR/start $Instance || echo Upgrade failed not restarting gitea@$Instance service