You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.0 KiB
Bash

#!/usr/bin/env bash
# game server control(build, tar, start, stop, ...) script file
# Longwei Lai
###################################################################
# define current path and script path
CUR_PATH="`pwd`"
SCRIPT_PATH="$(cd "`dirname "$0"`" && pwd)" # .../shells
FRAMEWORK_PATH="`dirname "${SCRIPT_PATH}"`" # .../framework
MISC_SCRIPTS_PATH="${SCRIPT_PATH}/misc_scripts" # .../misc_scripts
SVR_PATH="$(dirname "${FRAMEWORK_PATH}")" # .../*-server
# include framework header file and logic header file
cd "${MISC_SCRIPTS_PATH}"
source "${MISC_SCRIPTS_PATH}/lnx_fwk.sh"
source "${MISC_SCRIPTS_PATH}/lnx_logic.sh"
cd "${CUR_PATH}"
# main function(implemented command dispatch logic)
function main()
{
# firstly, ensure environment
env_ensure
# do command dispatch
local args=($@)
local cmd=${args[0]}
local cmd_args=${args[@]:1}
case "${cmd}" in
# server build/tarball commands
up|update)
update_server ${cmd_args}
;;
ver_info)
get_server_version_info ${cmd_args}
;;
switch_branch)
switch_branch ${cmd_args}
;;
make|build)
make_server ${cmd_args}
;;
tar|compress)
tar_server ${cmd_args}
;;
hfg|hotfix_gs)
hotfix_zip_gs ${cmd_args}
;;
# fake time about commands
read_faketime)
log_info $(read_faketime)
;;
clear_faketime)
clear_faketime
log_info "fake time setting cleared"
;;
# special command help pages show commands
help_gameserver|help_gs)
list_help_gameserver ${cmd_args}
;;
help_loginserver|help_ls)
list_help_loginserver ${cmd_args}
;;
# test commands
# ...
# other server control commands
*)
server_ctrl_cmd_adapt ${args[@]}
;;
esac
}
main $@