You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
627 B
31 lines
627 B
#!/bin/sh |
|
## |
|
## consul-openpkg-service -- Consul utility for checking OpenPKG package "active" status |
|
## |
|
|
|
# sanity check usage |
|
if [ $# -ne 1 ]; then |
|
echo "USAGE: consul-openpkg-service <package>" 1>&2 |
|
exit 1 |
|
fi |
|
|
|
# query package status |
|
package="$1" |
|
eval `@l_prefix@/bin/openpkg rc -s "$package" status` |
|
if [ $? -ne 0 ]; then |
|
exit 1 |
|
fi |
|
|
|
# translate OpenPKG "active" status to Consul check script exit code |
|
var=`echo "$package" | sed -e 's;-;_;g'` |
|
var="${var}_active" |
|
eval "val=\$$var" |
|
if [ ".$val" = .yes ]; then |
|
code=0 |
|
else |
|
code=2 |
|
fi |
|
|
|
# die gracefully with Consul check script exit code |
|
exit $code |
|
|
|
|