gitea/scripts/systemd/restart

11 lines
384 B
Plaintext
Raw Normal View History

#!/bin/bash
ServiceName=gitea
Instance=$1
[[ ! $1 ]] && echo warning no instance supplied using default && Instance=default
Service=$ServiceName@$Instance
sudo systemctl restart $Service
sleep 5
systemctl is-active --quiet $Service && \
echo $ServiceName $Instance was sucessfully restarted || \
(echo error: unable to restart $Service; "$(dirname "$BASH_SOURCE")"/log $Instance 20;)