17 lines
512 B
Plaintext
17 lines
512 B
Plaintext
|
#!/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 $Service is already running
|
||
|
else
|
||
|
echo starting $Service....
|
||
|
sudo systemctl daemon-reload
|
||
|
sudo systemctl start $Service
|
||
|
sleep 5
|
||
|
systemctl is-active --quiet $Service && \
|
||
|
echo $ServiceName $Instance is now running || \
|
||
|
(echo error: unable to start $Service; "$(dirname "$BASH_SOURCE")"/log $Instance 20;)
|
||
|
fi
|