Check if service unit is present before trying to restart it

This commit is contained in:
Mikolaj Izdebski 2018-02-22 09:35:08 +00:00
parent 50a5082089
commit 120fc846c5

View file

@ -6,4 +6,5 @@
#
SERVICE=$1
/usr/bin/systemctl try-restart $1
# Check if service unit is present before trying to restart it
/usr/bin/systemctl cat $1.service &>/dev/null && /usr/bin/systemctl try-restart $1