correct script to start server

This commit is contained in:
Jerome Sagnole 2017-10-09 22:14:26 +02:00
parent 9fe5d4cf96
commit 495eebebe9
3 changed files with 72 additions and 15 deletions

View file

@ -109,6 +109,47 @@ status_all()
status_program 'ras' 'ryzom_admin_service'
}
function create_default_file_for_screen()
{
# on scrren mode, we launch with root right
# But file are created on root, so , to solve that, we generate directory and file before
create_dir_gameserver '/home/gameserver/khanat/server/bms_master'
create_dir_gameserver '/home/gameserver/khanat/server/rws'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/characters_offline_commands'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/characters'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/characters/002'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/ai_script_data'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/sale_store'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/www'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/www/302'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/www/302/ke'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/www/302/ke/kem'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/totems'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/logs'
create_dir_gameserver '/home/gameserver/khanat/server/save_shard/sdb'
create_dir_gameserver '/home/gameserver/khanat/server/pds'
create_dir_gameserver '/home/gameserver/khanat/server/pds/00000000'
create_dir_gameserver '/home/gameserver/khanat/server/pds/00000000/logs'
create_dir_gameserver '/home/gameserver/khanat/server/gpms'
create_dir_gameserver '/home/gameserver/khanat/server/aes'
create_dir_gameserver '/home/gameserver/khanat/server/lgs'
create_dir_gameserver '/home/gameserver/khanat/server/data_shard/primitive_cache'
create_dir_gameserver '/home/gameserver/khanat/server/su'
create_dir_gameserver '/home/gameserver/khanat/server/ms'
create_dir_gameserver '/home/gameserver/khanat/server/egs'
create_dir_gameserver '/home/gameserver/khanat/server/data_shard_local'
create_dir_gameserver '/home/gameserver/khanat/server/data_shard_local/statistics'
create_dir_gameserver '/home/gameserver/khanat/server/fes'
create_dir_gameserver '/home/gameserver/khanat/server/mfs'
create_dir_gameserver '/home/gameserver/khanat/server/ras'
create_dir_gameserver '/home/gameserver/khanat/server/ios'
create_dir_gameserver '/home/gameserver/khanat/server/sbs'
create_dir_gameserver '/home/gameserver/khanat/server/ais_newbyland'
create_dir_gameserver '/home/gameserver/khanat/server/rns'
create_dir_gameserver '/home/gameserver/khanat/server/ts'
}
#####################
# MAIN
#####################
@ -193,15 +234,15 @@ sudo /etc/init.d/ssh restart
msg_debug "Update configuration with new IP"
tmp=$(hostname -I)
export addressip=${tmp//[[:blank:]]/}
sed -i -r 's/(FSListenHost)(.*)(=)(.*)(;)/FSListenHost = "'"$addressip"'";/g' $KHANAT_PATH/server/frontend_service.cfg || exit 2
sudo sed -i -r 's/(FSListenHost)(.*)(=)(.*)(;)/FSListenHost = "'"$addressip"'";/g' $KHANAT_PATH/server/frontend_service.cfg || exit 2
#####################
# Reconfigure database
#####################
msg_debug "Reconfigure database"
msg_debug "Reconfigure database : Configure Domain"
## Configure Domain
mysql -u root -e "use nel;
sudo mysql -u root -e "use nel;
UPDATE nel.domain
SET backup_patch_url = '$addressip:23001'
, patch_urls = '$addressip/patch'
@ -212,13 +253,15 @@ SET backup_patch_url = '$addressip:23001'
WHERE domain_id = 12;" || exit 2
# Configure nel.shard
mysql -u root -e "use nel;
msg_debug "Reconfigure database : Configure nel.shard"
sudo mysql -u root -e "use nel;
UPDATE nel.shard
SET WsAddr = '$addressip:'
WHERE ShardId = 302;" || exit 2
# Configure nel_tool.neltool_domains
mysql -u root -e "use nel;
msg_debug "Reconfigure database : Configure nel_tool.neltool_domains"
sudo mysql -u root -e "use nel;
UPDATE nel_tool.neltool_domains
SET domain_as_host = '$addressip'
WHERE domain_id = 12;" || exit 2
@ -230,30 +273,37 @@ WHERE domain_id = 12;" || exit 2
msg_debug "Start khanat"
if [[ $METHOD_START -eq 0 ]]
then
source /home/gameserver/.bashrc; export RYZOM_PATH=$KHANAT_PATH; echo ".$RYZOM_PATH."; $KHANAT_HOME/khanat/tools/scripts/linux/shard start
#create_default_file_for_screen
source /home/gameserver/.bashrc; export RYZOM_PATH=$KHANAT_PATH; cd "$RYZOM_PATH"; $KHANAT_HOME/khanat/tools/scripts/linux/shard start
#sudo -u gameserver 'source /home/gameserver/.bashrc; export RYZOM_PATH=$KHANAT_PATH; echo ".$RYZOM_PATH."; $KHANAT_HOME/khanat/tools/scripts/linux/shard start'
elif [[ $METHOD_START -eq 1 ]]
then
su -c /opt/ext/servercontainer_launch_service.sh gameserver
#su -c /opt/ext/servercontainer_launch_service.sh gameserver
/opt/ext/servercontainer_launch_service.sh
sleep 10
tail -n+0 -f /home/gameserver/log/khanat/log.log
elif [[ $METHOD_START -eq 2 ]]
then
su -c /opt/ext/servercontainer_launch_service.sh gameserver
#su -c /opt/ext/servercontainer_launch_service.sh gameserver
/opt/ext/servercontainer_launch_service.sh
sleep 10
watch cat /home/gameserver/khanat/server/aes_nagios_report.txt
elif [[ $METHOD_START -eq 3 ]]
then
su -c /opt/ext/servercontainer_launch_service.sh gameserver
#su -c /opt/ext/servercontainer_launch_service.sh gameserver
/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
su -c /opt/ext/servercontainer_launch_service.sh gameserver
#su -c /opt/ext/servercontainer_launch_service.sh gameserver
/opt/ext/servercontainer_launch_service.sh
sleep 10
watch /opt/ext/servercontainer_launch_status.sh --no-color
elif [[ $METHOD_START -eq 5 ]]
then
#su -c /opt/ext/servercontainer_launch_service.sh gameserver
/opt/ext/servercontainer_launch_service.sh
#sleep 10
bash
else

View file

@ -146,6 +146,7 @@ do
;;
-r|--remove)
REMOVE=1
CONFIGUREKHANATSERVER=1
shift
;;
-c|--clean-container-khanat)
@ -325,9 +326,13 @@ then
then
KHANAT_DATA_CLIENT_DIR="$(dirname $rootdir)/khanat-data-client"
fi
if [[ ! (-d $rootdir/$ROOTDATAKHANAT) ]]
then
CONFIGUREKHANATSERVER=1
fi
fi
DIRBUILD="${rootdir}/code/${LOCALBUILDDIR}"
DIRBUILD="${rootdir}/${LOCALBUILDDIR}"
msg_debug "calldir: $calldir"
msg_debug "basedir: $basedir"
@ -469,6 +474,7 @@ fi
if [[ $UPDATEDATA -ne 0 ]]
then
msg_info "UPDATE KHANAT SERVER"
cd $rootdir; docker run -it --hostname=khanat \
-v /etc/localtime:/etc/localtime:ro \
-v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \
@ -487,6 +493,7 @@ if [[ $LAUNCHKHANAT -ne 0 ]]
then
msg_info "START KHANAT SERVER"
cd $rootdir; docker run -it --hostname=khanat \
-u "$(id -u $USERNAME):$(id -g $USERNAME)" \
-v /etc/localtime:/etc/localtime:ro \
-v ${rootdir}/${LOCALBUILDDIR}/bin:/usr/local/bin:ro \
-v ${rootdir}/code/web/:/home/gameserver/ext/khanatweb:ro \
@ -497,7 +504,7 @@ then
-v ${rootdir}/$DIRDATABASE:/home/gameserver/database:rw \
-v ${rootdir}/$DIRKHANAT:/home/gameserver/khanat:rw \
-v ${rootdir}/dist/docker/server/debian/common/:/opt/ext:ro \
${IMAGEKHANATSERVER} /opt/ext/servercontainer_launch_auto.sh $METHODSTARTSERVER
${IMAGEKHANATSERVER} /opt/ext/servercontainer_launch_auto.sh $METHODSTARTSERVER -d
fi
trap '' EXIT

View file

@ -278,7 +278,7 @@ then
if [[ -f ${rootdir}/ryzomcore.tar.gz ]]
then
sumsrc=$(md5sum ${rootdir}/code/${LOCALBUILDDIR}/ryzomcore-0.12.0..tar.gz | awk '{print $1}')
sumsrc=$(md5sum ${rootdir}/${LOCALBUILDDIR}/ryzomcore-0.12.0..tar.gz | awk '{print $1}')
sumdst=$(md5sum ${rootdir}/ryzomcore.tar.gz | awk '{print $1}')
else
sumsrc=1
@ -288,12 +288,12 @@ then
if [[ "$sumsrc" != "$sumdst" ]]
then
msg_debug "copy ryzomcore"
cp ${rootdir}/code/${LOCALBUILDDIR}/ryzomcore-0.12.0..tar.gz ${rootdir}/ryzomcore.tar.gz || exit 2
cp ${rootdir}/${LOCALBUILDDIR}/ryzomcore-0.12.0..tar.gz ${rootdir}/ryzomcore.tar.gz || exit 2
KHANATSERVER=1
fi
fi
DIRBUILD="${rootdir}/code/${LOCALBUILDDIR}"
DIRBUILD="${rootdir}/${LOCALBUILDDIR}"
msg_debug "calldir: $calldir"
msg_debug "basedir: $basedir"