khanat-server-docker-NeL/server/debian/common/servercontainer_launch_service.sh

168 lines
6.7 KiB
Bash
Raw Normal View History

#!/bin/bash
#
# Script to launch khaganat
# (see shard.screen.rc)
# Copyright (C) 2017 AleaJactaEst
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
usage()
{
cat << EOF
usage:$0 [options]
Script to launch khaganat
options:
-h, --help : Show this help
-d, --debug : Show debug message
EOF
}
function start_stop()
{
nameservice=$1
printf RUNNING > /home/gameserver/khanat/server/${nameservice}/${nameservice}.state
chown_gameserver /home/gameserver/khanat/server/${nameservice}/${nameservice}.state
(cd $3; nohup $2)
printf STOPPED > /home/gameserver/khanat/server/${nameservice}/${nameservice}.state
}
function launch_service()
{
nameservice=$1
create_dir_gameserver "/home/gameserver/khanat/server/${nameservice}"
create_file_gameserver "/home/gameserver/khanat/server/$1/$1.pid"
create_file_gameserver "/home/gameserver/log/khanat/$nameservice.out"
create_file_gameserver "/home/gameserver/log/khanat/$nameservice.err"
start_stop "$1" "$2" "/home/gameserver/khanat/server/$1" 1>/home/gameserver/log/khanat/$nameservice.out 2>/home/gameserver/log/khanat/$nameservice.err &
echo "$!" > /home/gameserver/khanat/server/$1/$1.pid
#nohup $2 1>/dev/null 2>&1 &
#echo "$!" > /home/gameserver/khanat/server/$1.pid
#printf RUNNING > /home/gameserver/khanat/server/${nameservice}/${nameservice}.state
}
#####################
# MAIN
#####################
source /opt/ext/servercontainer_function.sh
msg_info "START : $(basename $0)"
while test $# -gt 0
do
case "$1" in
-h|--help)
usage
exit 1
;;
-d|--debug)
set_debug 1
shift
;;
*)
msg_error "options '$1' not recognize"
usage
exit 1
;;
esac
done
####################################
# Load Environment
####################################
msg_debug "Load environment"
if [[ ! -f /opt/khanat_config.sh ]]
then
echo "ERROR - missing /opt/khanat_config.sh"
exit 2
fi
source /opt/khanat_config.sh
if [[ ! -f /home/gameserver/.bashrc ]]
then
echo "ERROR - missing /home/gameserver/.bashrc"
exit 2
fi
source /home/gameserver/.bashrc
####################################
# Load Environment
####################################
create_dir_gameserver '/home/gameserver/log/khanat'
cd /home/gameserver/log/khanat
# aes : admin_executor_service.log
launch_service 'aes' 'ryzom_admin_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --fulladminname=admin_executor_service --shortadminname=AES'
# bms_master : backup_service.log
launch_service 'bms_master' 'ryzom_backup_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --writepid -P49990'
# bms_pd_master
# launch_service 'bms_pd_master' 'ryzom_backup_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --writepid -P49992'
# egs : entities_game_service.log
launch_service 'egs' 'ryzom_entities_game_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --writepid'
# gpms : gpm_service.log
launch_service 'gpms' 'ryzom_gpm_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --writepid'
# ios : input_output_service.log
launch_service 'ios' 'ryzom_ios_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --writepid'
# rns : naming_service.log
launch_service 'rns' 'ryzom_naming_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --writepid'
# rws : welcome_service.log
launch_service 'rws' 'ryzom_welcome_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --writepid'
# ts : tick_service.log
launch_service 'ts' 'ryzom_tick_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --writepid'
# ms : mirror_service.log
launch_service 'ms' 'ryzom_mirror_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --writepid'
# ais_newbyland : ai_service.log
launch_service 'ais_newbyland' 'ryzom_ai_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --writepid -mCommon:Newbieland:Post'
# mfs : mail_forum_service.log
launch_service 'mfs' 'ryzom_mail_forum_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --writepid'
# su : shard_unifier_service.log
launch_service 'su' 'ryzom_shard_unifier_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --writepid'
# fes : frontend_service.log
launch_service 'fes' 'ryzom_frontend_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --writepid'
# sbs : session_browser_server.log
launch_service 'sbs' 'ryzom_session_browser_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --writepid'
# lgs : logger_service.log
launch_service 'lgs' 'ryzom_logger_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --writepid'
# mos
# launch_service 'mos' 'ryzom_monitor_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --writepid'
# pdss
#launch_service 'pdss' 'ryzom_pd_support_service -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --writepid'
# ras : admin_service.log
launch_service 'ras' 'ryzom_admin_service --fulladminname=admin_service --shortadminname=AS -A/home/gameserver/khanat/server -C/home/gameserver/khanat/server -L/home/gameserver/log/khanat --nobreak --writepid'
######################
#
######################