summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRamón M. Gómez <ramongomez@us.es>2020-01-31 11:45:20 +0100
committerRamón M. Gómez <ramongomez@us.es>2020-01-31 11:45:20 +0100
commit6640e2cfaef23129837c00a95204dbf5f4419d06 (patch)
treeb95d93f9c8c76783b9fa0a1b90d274db54e23287
parent35f1277f660e56dacb085b2c255b5e4aae7b0c97 (diff)
#946: Script `setserveraddr` updates the interface parameter.
-rwxr-xr-xserver/bin/setserveraddr10
1 files changed, 6 insertions, 4 deletions
diff --git a/server/bin/setserveraddr b/server/bin/setserveraddr
index fc5efc5d..e6c34f80 100755
--- a/server/bin/setserveraddr
+++ b/server/bin/setserveraddr
@@ -77,8 +77,8 @@ if [ -n "$SERVERIP" ]; then
done
# Restarting DHCP service if its configuration has changed.
if [ $CHANGE == 1 ]; then
- for f in /etc/init.d/{isc-dhcp-server,dhcp3-server,dhcpd}; do
- [ -x $f ] && $f restart
+ for s in isc-dhcp-server dhcp3-server dhcpd; do
+ restart $s &>/dev/null && break
done
else
echo "DHCP configuration has not changed."
@@ -92,6 +92,7 @@ if [ -n "$SERVERIP" ]; then
for f in $OPENGNSYS/{etc/{ogAdmServer,ogAdmRepo,ogAdmAgent}.cfg,www/controlacceso.php,client/etc/ogAdmClient.cfg}; do
# Updating configuration variables (if URL does not contain "localhost").
sed -e "s,\(ServidorAdm\|IPlocal\)=.*,\1=$SERVERIP," \
+ -e "s,INTERFACE=.*,INTERFACE=$SERVERDEV," \
-e "s,UrlMenu=https?://\([^/]*\)/\(.*\),UrlMenu=https://$SERVERIP/\2," \
-e '/localhost/!s,https\?://[^/]*/\(.*\),https://'$SERVERIP'/\1,' $f >$tmpfile
file="${f/./-$SERVERDEV.}"
@@ -106,7 +107,8 @@ if [ -n "$SERVERIP" ]; then
# Processing when something has changed.
if [ $CHANGE == 1 ]; then
# Restart OpenGnsys services.
- /etc/init.d/opengnsys restart
+ echo "Restarting services..."
+ restart opengnsys >/dev/null
source $DEFAULTFILE
# If OpenGnsys Server is active, updating the database.
if [ "$RUN_OGADMSERVER" == "yes" ]; then
@@ -139,7 +141,7 @@ Default server interface set to: $SERVERDEV ($SERVERIP)
Manual tasks:
- Check DHCP configuration file and restart service, if needed.
- Check PXE files.
-- Log-in as Web Console user:
+- Log-in as Web Console user:
- Check menu URLs.
- Note: Run "settoken" script to update authentication tokens.
EOT