From 5d3961ae4fcb093e37c45155ce020564918b32d7 Mon Sep 17 00:00:00 2001 From: AleaJactaEst Date: Wed, 22 Aug 2018 23:37:29 +0200 Subject: [PATCH] start in default with OpenNel-Manager, remove old option, create directory for gpms --- .../common/servercontainer_launch_auto.sh | 165 +++--------------- 1 file changed, 22 insertions(+), 143 deletions(-) diff --git a/server/debian/common/servercontainer_launch_auto.sh b/server/debian/common/servercontainer_launch_auto.sh index 0ea85fd..3f316d6 100755 --- a/server/debian/common/servercontainer_launch_auto.sh +++ b/server/debian/common/servercontainer_launch_auto.sh @@ -16,6 +16,8 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +declare -i METHOD_START=0 + usage() { cat << EOF @@ -23,91 +25,14 @@ usage:$0 [options] Prepare and launch server khanat options: - -h, --help : Show this help - -d, --debug : Show debug message - --start-khanat-with-screen : start with screen - --show-khanat-log : Show khanat log (after start) - --show-all-log : Show all log (after start) [apache, mysql, khanat] - --show-status-nagios : show status (ater start) - --show-status : show status (ater start) - --bash-after-start : command bash after start + -h, --help : Show this help + -d, --debug : Show debug message + --screen : start khanat with screen + --opennel-manager : (default) start khanat with OpenNel-Manager + --bash : launch bash (doesn't start khanat) EOF } -status_program() -{ - pid=$(cat /home/gameserver/khanat/server/$1/$1.pid) - ps -p $pid >/dev/null - if [[ $? -eq 0 ]] - then - pidstate="ok" - else - pidstate="ko" - fi - state=$(cat /home/gameserver/khanat/server/$1/$1.state) - echo "$1 $2 [$state] pid:$pid => $pidstate" -} - -status_all() -{ - # aes : admin_executor_service.log - status_program 'aes' 'ryzom_admin_service' - - # bms_master : backup_service.log - status_program 'bms_master' 'ryzom_backup_service' - - # bms_pd_master - # status_program 'bms_pd_master' 'ryzom_backup_service' - - # egs : entities_game_service.log - status_program 'egs' 'ryzom_entities_game_service' - - # gpms : gpm_service.log - status_program 'gpms' 'ryzom_gpm_service' - - # ios : input_output_service.log - status_program 'ios' 'ryzom_ios_service' - - # rns : naming_service.log - status_program 'rns' 'ryzom_naming_service' - - # rws : welcome_service.log - status_program 'rws' 'ryzom_welcome_service' - - # ts : tick_service.log - status_program 'ts' 'ryzom_tick_service' - - # ms : mirror_service.log - status_program 'ms' 'ryzom_mirror_service' - - # ais_newbyland : ai_service.log - status_program 'ais_newbyland' 'ryzom_ai_service' - - # mfs : mail_forum_service.log - status_program 'mfs' 'ryzom_mail_forum_service' - - # su : shard_unifier_service.log - status_program 'su' 'ryzom_shard_unifier_service' - - # fes : frontend_service.log - status_program 'fes' 'ryzom_frontend_service' - - # sbs : session_browser_server.log - status_program 'sbs' 'ryzom_session_browser_service' - - # lgs : logger_service.log - status_program 'lgs' 'ryzom_logger_service' - - # mos - # status_program 'mos' 'ryzom_monitor_service' - - # pdss - #status_program 'pdss' 'ryzom_pd_support_service' - - # ras : admin_service.log - status_program 'ras' 'ryzom_admin_service' -} - function create_default_file_for_screen() { # on screen mode, we launch with root right @@ -149,6 +74,12 @@ function create_default_file_for_screen() create_dir_gameserver '/home/gameserver/khanat/server/ts' || exit 2 } +function create_default_file_for_opennel_manager() +{ + create_dir_gameserver '/home/gameserver/log/khanat' || exit 2 + create_dir_gameserver '/home/gameserver/khanat/server/gpms' || exit 2 +} + ##################### # MAIN ##################### @@ -166,34 +97,18 @@ do set_debug 1 shift ;; - --start-khanat-with-screen) + --screen) METHOD_START=0 shift ;; - --show-khanat-log) + --bash) METHOD_START=1 shift ;; - --show-all-log) - METHOD_START=3 - shift - ;; - --show-status-nagios) + --opennel-manager) METHOD_START=2 shift ;; - --show-status) - METHOD_START=4 - shift - ;; - --bash-after-start) - METHOD_START=5 - shift - ;; - --start-with-manager) - METHOD_START=6 - shift - ;; *) msg_error "options '$1' not recognize" usage @@ -239,18 +154,6 @@ tmp=$(hostname -I) export addressip=${tmp//[[:blank:]]/} sudo sed -i -r 's/(FSListenHost)(.*)(=)(.*)(;)/FSListenHost = "'"$addressip"'";/g' $KHANAT_PATH/server/frontend_service.cfg || exit 2 -##################### -# Update configuration -##################### -msg_debug "Update configuration with new path" -newpath="$KHANAT_PATH/server/common/" -newpath=${newpath//\//\\\/} -for filecfg in $KHANAT_PATH/server/*.cfg -do - msg_debug "[$(basename $0):$LINENO] update $filecfg" - #sudo sed -i -r "s/..\/common\//$newpath/g" $filecfg - #sudo sed -i -r "s/..\/common\//common\//g" $filecfg -done ##################### # Reconfigure database @@ -286,55 +189,31 @@ WHERE domain_id = 12;" || exit 2 # Start khanat ##################### msg_debug "Start khanat" + if [ -f /home/gameserver/opennelmanager.flag ] then rm /home/gameserver/opennelmanager.flag || exit 2 fi + if [[ $METHOD_START -eq 0 ]] then msg_debug "start with screen" source /home/gameserver/.bashrc; export RYZOM_PATH=$KHANAT_PATH; cd "$RYZOM_PATH"; $KHANAT_HOME/khanat/tools/scripts/linux/shard start elif [[ $METHOD_START -eq 1 ]] then - msg_debug "start with show-khanat-log" - /opt/ext/servercontainer_launch_service.sh - sleep 10 - tail -n+0 -f /home/gameserver/log/khanat/log.log + msg_debug "launch bash" + bash elif [[ $METHOD_START -eq 2 ]] then - msg_debug "start with show-status-nagios" - /opt/ext/servercontainer_launch_service.sh - sleep 10 - watch cat /home/gameserver/khanat/server/aes_nagios_report.txt -elif [[ $METHOD_START -eq 3 ]] -then - msg_debug "start with show-all-log" - /opt/ext/servercontainer_launch_service.sh - sleep 10 - tail -n+0 -f /home/gameserver/log/apache2/* /home/gameserver/log/mysql/* /home/gameserver/log/khanat/* -elif [[ $METHOD_START -eq 4 ]] -then - msg_debug "start with status" - /opt/ext/servercontainer_launch_service.sh - sleep 10 - watch /opt/ext/servercontainer_launch_status.sh --no-color -elif [[ $METHOD_START -eq 5 ]] -then - msg_debug "start with show-status" - /opt/ext/servercontainer_launch_service.sh - #sleep 10 - bash -elif [[ $METHOD_START -eq 6 ]] -then - mkdir -p /home/gameserver/log/khanat || exit 2 msg_debug "start with OpenNelManager" touch /home/gameserver/opennelmanager.flag + create_default_file_for_opennel_manager python3 -m pymanager.manager -c /home/gameserver/khanat/khaganat.cfg --log DEBUG --filelog /home/gameserver/log/khanat/OpenNelManager.log --launch-program & #sleep 10 #screen -t terminal /bin/bash -l /bin/bash -l else - msg_error 'Bad option' + msg_error 'Bad option (METHOD_START:$METHOD_START)' exit 2 fi