script to test service and start if not
This commit is contained in:
parent
515cb4e851
commit
5c85f3d57b
13
scripts/systemctl-alive.sh
Normal file
13
scripts/systemctl-alive.sh
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# crontab -e
|
||||||
|
# * * * * * /bin/bash /etc/template_setup/scripts/systemctl-alive.sh
|
||||||
|
|
||||||
|
service=$@
|
||||||
|
/bin/systemctl -q is-active "$service.service"
|
||||||
|
status=$?
|
||||||
|
if [ "$status" == 0 ]; then
|
||||||
|
echo "OK"
|
||||||
|
else
|
||||||
|
/bin/systemctl start "$service.service"
|
||||||
|
fi
|
||||||
Loading…
Reference in New Issue
Block a user