script to test service and start if not

This commit is contained in:
deathbybandaid 2024-02-21 09:31:46 -05:00
parent 515cb4e851
commit 5c85f3d57b

View 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