From 4972d15ecd21a6f8dfe6f8451d19ac678fa2865b Mon Sep 17 00:00:00 2001 From: Roberto Hueso Gómez Date: Mon, 19 Oct 2020 13:38:11 +0200 Subject: #988 Read json config file in scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch implements the function source_json_config() that is used to read the new ogserver.json config file in the scripts. This replaces the old 'source .../ogserver.cfg'. Co-authored-by: Javier Sánchez Parra --- server/bin/addtodhcp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'server/bin/addtodhcp') diff --git a/server/bin/addtodhcp b/server/bin/addtodhcp index 42fe7f8e..80fc5fac 100755 --- a/server/bin/addtodhcp +++ b/server/bin/addtodhcp @@ -15,7 +15,7 @@ # Variables. PROG="$(basename "$0")" OPENGNSYS=${OPENGNSYS:-"/opt/opengnsys"} -SERVERCONF=$OPENGNSYS/etc/ogserver.cfg +SERVERCONF=$OPENGNSYS/etc/ogserver.json DHCPCONF=/etc/dhcp/dhcpd.conf DHCPCONFBCK="$DHCPCONF-$(date +"%Y%m%d")" @@ -26,7 +26,7 @@ source $OPENGNSYS/lib/ogfunctions.sh || exit 1 [ "$*" == "version" ] && version # Error control. [ "$USER" != "root" ] && raiseError access "Need to be root" -source $SERVERCONF 2>/dev/null || raiseError access "Cannot read OpenGnsys Server configuration file" +source_json_config $SERVERCONF 2>/dev/null || raiseError access "Cannot read OpenGnsys Server configuration file" # Processing parameters. opts=$(getopt -n "$PROG" -l exam,file:,restart -o 'ef:r' -- "$@" ) || raiseError usage -- cgit v1.2.3-18-g5258