summaryrefslogtreecommitdiffstats
path: root/libexec/fence/ssh-trigger.d/1000-service-check.sh
blob: 32f7ae7440a9669f6aa3dc4cdf813c88eab976fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh -x

set -e

SENDER="$(dig -x ${SENDER_IP})"
CLUSTER="$(echo ${SENDER} | awk -F. '{ print $(NF-2)"."$(NF-1)"."$NF }' )"
SERVICE="$(echo ${SENDER} | grep ${CLUSTER})"

echo "Service: ${SERVICE}."

# check if the same cluster
if [ -z ${SERVICE} ]
then
	echo "Permission denied."
	exit 1
fi