summaryrefslogtreecommitdiffstats
path: root/server/bin/setserveraddr
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2020-05-15 10:37:37 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-06-02 12:32:36 +0200
commit41f8ff6f5a596a61690a3648e123a346ae44c3ce (patch)
tree1f13625959633fddf84dcc3a1ce79859fa1129d3 /server/bin/setserveraddr
parent5ee13ae9c3c87840a7ae43d2308706956367f78e (diff)
#980 use json file format in ogClient
Diffstat (limited to 'server/bin/setserveraddr')
-rwxr-xr-xserver/bin/setserveraddr8
1 files changed, 4 insertions, 4 deletions
diff --git a/server/bin/setserveraddr b/server/bin/setserveraddr
index c7920e6a..203e095b 100755
--- a/server/bin/setserveraddr
+++ b/server/bin/setserveraddr
@@ -33,7 +33,7 @@ source $OPENGNSYS/lib/ogfunctions.sh || exit 1
[ "$USER" != "root" ] && raiseError access "Need to be root"
[ $# -ne 1 ] && raiseError usage
[ -r $DEFAULTFILE ] || raiseError access "Cannot read default configuration file"
-for f in $OPENGNSYS/{etc/{ogAdmServer,ogAdmRepo}.cfg,www/controlacceso.php,client/ogClient/cfg/ogclient.cfg}; do
+for f in $OPENGNSYS/{etc/{ogAdmServer,ogAdmRepo}.cfg,www/controlacceso.php,client/ogClient/cfg/ogclient.json}; do
[ -w $f ] || raiseError access "Cannot write to file: $f"
done
@@ -106,9 +106,9 @@ if [ -n "$SERVERIP" ]; then
# Processing when something has changed.
if [ $CHANGE == 1 ]; then
# Config ogClient.
- sed -i -e "s/^ip=.*/ip=$SERVERIP/g" \
- -e "s/^url=https:\/\/[0-9\.]*\//url=https:\/\/$SERVERIP\//g" \
- $OPENGNSYS/client/ogClient/cfg/ogclient.cfg
+ IP_PATTERN="[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}"
+ sed -i -e "s/$IP_PATTERN/$SERVERIP/g" \
+ "$OPENGNSYS"/client/ogClient/cfg/ogclient.json
# Restart OpenGnsys services.
echo "Restarting services..."
restart opengnsys >/dev/null