Updated commandline reconfiguration tool.

*) fixed "set HTTP port" (root cause was sloppy implementation of method
which gets values from config file)
*) added "set HTTPS port"
pull/1/head
Marc Nause 11 years ago
parent b44626e55b
commit 172d7e68da

@ -2,15 +2,11 @@
# THIS SCRIPT CAN BE USED TO EDIT SOME BASIC SETTINGS OF YACY # THIS SCRIPT CAN BE USED TO EDIT SOME BASIC SETTINGS OF YACY
# #
# Copyright 2009 by Marc Nause; marc.nause@gmx.de # Copyright 2009 - 2014 by Marc Nause; marc.nause@gmx.de
# #
# This is a part of YaCy, a peer-to-peer based web search engine. # This is a part of YaCy, a peer-to-peer based web search engine.
# http://www.yacy.net # http://www.yacy.net
# #
# $LastChangedDate$
# $LastChangedRevision$
# $LastChangedBy$
#
# LICENSE # LICENSE
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
@ -158,10 +154,10 @@ change_mem_settings()
esac esac
} }
# CHANGES THE PORT SETTINGS # CHANGES THE PORT SETTINGS. PROPERTY NAME IN FIRST PARAMETER, HUMAN READABLE NAME IN SECOND PARAMETER.
change_port_settings() change_port_settings()
{ {
if read_parameter 'port' if read_parameter $1
then then
CURRENTPORT="$REPLY" CURRENTPORT="$REPLY"
else else
@ -169,19 +165,19 @@ change_port_settings()
fi fi
echo echo
echo -n "Which port do you want YaCy to use (currently $CURRENTPORT)? " echo -n "Which port do you want YaCy to use for $2 (currently $CURRENTPORT)? "
read INPUT read INPUT
case $INPUT in case $INPUT in
[0-9]*) [0-9]*)
if [ "$INPUT" -ge 1024 ] && [ "$INPUT" -le 65535 ]; if [ "$INPUT" -ge 1024 ] && [ "$INPUT" -le 65535 ];
then then
replace_parameter 'port' $INPUT replace_parameter $1 $INPUT
STATUS="Port settings have been changed. YaCy listens to port $INPUT now." STATUS="Port settings for $2 have been changed. YaCy listens to port $INPUT now."
else else
echo echo
echo 'Please use choose a number between 1024 and 65535.' echo 'Please use choose a number between 1024 and 65535.'
change_port_settings change_port_settings $1 $2
fi fi
;; ;;
'') '')
@ -190,7 +186,7 @@ change_port_settings()
*) *)
echo echo
echo 'Please enter a number or just hit enter to abort.' echo 'Please enter a number or just hit enter to abort.'
change_port_settings change_port_settings $1 $2
;; ;;
esac esac
} }
@ -249,7 +245,8 @@ print_menu()
echo "Make your choice:" echo "Make your choice:"
echo "[1] change memory settings" echo "[1] change memory settings"
echo "[2] change admin password" echo "[2] change admin password"
echo "[3] change port" echo "[3] change HTTP port"
echo "[4] change HTTPS port"
echo "[0] quit" echo "[0] quit"
echo echo
echo "Status: $STATUS" echo "Status: $STATUS"
@ -259,7 +256,7 @@ print_menu()
# IF A SECOND PARAMETER, WHICH IS A VALID sed OPERATION LIKE "s/xxx/yyy/", EXISTS. # IF A SECOND PARAMETER, WHICH IS A VALID sed OPERATION LIKE "s/xxx/yyy/", EXISTS.
read_parameter() read_parameter()
{ {
REPLY="`cat "$CONFIGFILE" | grep "^$1" | sed "s/\(^$1 *= *\)\(.*\)$/\2/"`" REPLY="`cat "$CONFIGFILE" | grep "^$1=" | sed "s/\(^$1 *= *\)\(.*\)$/\2/"`"
if [ "$2" != '' ] if [ "$2" != '' ]
then then
REPLY="`echo "$REPLY" | sed $2`" REPLY="`echo "$REPLY" | sed $2`"
@ -295,7 +292,10 @@ do
change_admin_settings change_admin_settings
;; ;;
3) 3)
change_port_settings change_port_settings 'port' 'HTTP'
;;
4)
change_port_settings 'port.ssl' 'HTTPS'
;; ;;
esac esac
print_menu print_menu

Loading…
Cancel
Save