gitea/scripts/systemd/stop

16 lines
483 B
Bash
Executable File

#!/bin/bash
ServiceName=gitea
Instance=$1
[[ ! $1 ]] && echo warning no instance supplied using default && Instance=default
Service=$ServiceName@$Instance
if systemctl is-active --quiet $Service; then
echo stopping $Service...
sudo systemctl stop $Service
sleep 5
systemctl is-active --quiet $Service && \
(echo error: unable to stop $Instance; "$(dirname "$BASH_SOURCE")"/log $Instance 20;) || \
echo $Instance is now stopped
else
echo $Instance is already stopped
fi