1
0
mirror of https://github.com/omni-lchen/zabbix-ssl synced 2025-07-06 09:24:24 +02:00
Ildar Davletov 8c786d5f8b Fix syntax.
2018-06-06 17:44:19 +03:00

16 lines
532 B
Bash

#!/bin/bash
#Author: Long Chen
#Date: 25/01/2017
#Description: A script to get a list of domains in json format
#Requires: jq - https://stedolan.github.io/jq/
DOMAIN_GROUP=$1
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
ALL_DOMAINS=$SCRIPT_DIR"/ssl/sslCertDomains.json"
QUERY_DOMAINS=$(cat $ALL_DOMAINS | jq --arg DOMAIN_GROUP $DOMAIN_GROUP -r '.[$DOMAIN_GROUP][].domain' | xargs 2>/dev/null)
for domain in $QUERY_DOMAINS; do
domainlist="$domainlist,"'{"{#DOMAIN}":"'${domain# }'"}'
done
echo '{"data":['${domainlist#,}']}'