gitea/scripts/systemd/persist
David Kebler d2551161d2 watch script working now for realtime edits of UI and config
fixed bug where passed arguments  need to be saved for reuse further in script
2020-12-13 17:16:53 -08:00

28 lines
621 B
Bash
Executable file

#!/bin/bash
declare OPTARG
declare OPTION
declare OPTIND=0
state=enable
while getopts 'd' OPTION; do
case "$OPTION" in
d) state=disable;;
esac
done
shift $(( $OPTIND - 1 ))
Instance=$1
ServiceName=gitea
Instance=$1
[[ ! $1 ]] && echo warning no instance supplied using default && Instance=default
Service=$ServiceName@$Instance
if systemctl is-active --quiet $Service; then
sudo systemctl $state $Service
systemctl is-enabled --quiet $Service && \
echo $Service boot persistance is enabled || \
echo $Service boot persistance is disabled
else
echo "can't persist $Instance as it must be running first"
fi