Add fix script
This commit is contained in:
parent
8a9d007a6f
commit
a1d18d4e49
47
bin/fix
Executable file
47
bin/fix
Executable file
@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Try to fix a service
|
||||||
|
#
|
||||||
|
# By default, the problem is "solved" the Microsoft way
|
||||||
|
# (stop and start).
|
||||||
|
# To do something more intelligent, create a
|
||||||
|
# /federated/services/<service>/fix
|
||||||
|
# script.
|
||||||
|
|
||||||
|
if [ "$#" != 1 ]; then
|
||||||
|
echo Usage: $0 service
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
SERVICE="$1"
|
||||||
|
|
||||||
|
if /federated/bin/check ${SERVICE}; then
|
||||||
|
echo "${SERVICE} doesn't seem to be broken"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
/federated/bin/stop ${SERVICE}
|
||||||
|
/federated/bin/start ${SERVICE}
|
||||||
|
|
||||||
|
if /federated/bin/check ${SERVICE}; then
|
||||||
|
echo "${SERVICE} was (probably) fixed by a restart"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -e /federated/services/${SERVICE}/fix ] && . /federated/services/${SERVICE}/fix
|
||||||
|
|
||||||
|
if /federated/bin/check ${SERVICE}; then
|
||||||
|
echo "${SERVICE} was (probably) fixed by the service fix script"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
/federated/bin/stop ${SERVICE}
|
||||||
|
/federated/bin/start ${SERVICE}
|
||||||
|
|
||||||
|
if /federated/bin/check ${SERVICE}; then
|
||||||
|
echo "${SERVICE} was (probably) fixed by restarting after running the fix script"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${SERVICE} is still broken. Please improve the fix script."
|
||||||
|
exit 1
|
Loading…
x
Reference in New Issue
Block a user