Change shard scripts to work with dash shell (issue #99)

Fix 'Press ENTER key' functionality
This commit is contained in:
Nimetu 2014-01-27 23:15:31 +02:00
parent 8c4a6fc2da
commit a6629ddd32
3 changed files with 69 additions and 60 deletions

View file

@ -16,58 +16,62 @@ hardstatus alwayslastline "%w"
chdir $RYZOM_PATH/server chdir $RYZOM_PATH/server
screen -t aes /bin/sh service_launcher.sh aes $RYZOM_PATH/../build/bin/ryzom_admin_service -A. -C. -L. --nobreak --fulladminname=admin_executor_service --shortadminname=AES screen -t aes /bin/sh ../tools/scripts/linux/service_launcher.sh aes $RYZOM_PATH/../build/bin/ryzom_admin_service -A. -C. -L. --nobreak --fulladminname=admin_executor_service --shortadminname=AES
# bms_master # bms_master
screen -t bms_master /bin/sh service_launcher.sh bms_master $RYZOM_PATH/../build/bin/ryzom_backup_service -C. -L. --nobreak --writepid -P49990 screen -t bms_master /bin/sh ../tools/scripts/linux/service_launcher.sh bms_master $RYZOM_PATH/../build/bin/ryzom_backup_service -C. -L. --nobreak --writepid -P49990
# bms_pd_master # bms_pd_master
#screen -t bms_pd_master /bin/sh service_launcher.sh bms_pd_master $RYZOM_PATH/../build/bin/ryzom_backup_service -C. -L. --nobreak --writepid -P49992 #screen -t bms_pd_master /bin/sh ../tools/scripts/linux/service_launcher.sh bms_pd_master $RYZOM_PATH/../build/bin/ryzom_backup_service -C. -L. --nobreak --writepid -P49992
# egs # egs
screen -t egs /bin/sh service_launcher.sh egs $RYZOM_PATH/../build/bin/ryzom_entities_game_service -C. -L. --nobreak --writepid screen -t egs /bin/sh ../tools/scripts/linux/service_launcher.sh egs $RYZOM_PATH/../build/bin/ryzom_entities_game_service -C. -L. --nobreak --writepid
# gpms # gpms
screen -t gpms /bin/sh service_launcher.sh gpms $RYZOM_PATH/../build/bin/ryzom_gpm_service -C. -L. --nobreak --writepid screen -t gpms /bin/sh ../tools/scripts/linux/service_launcher.sh gpms $RYZOM_PATH/../build/bin/ryzom_gpm_service -C. -L. --nobreak --writepid
# ios # ios
screen -t ios /bin/sh service_launcher.sh ios $RYZOM_PATH/../build/bin/ryzom_ios_service -C. -L. --nobreak --writepid screen -t ios /bin/sh ../tools/scripts/linux/service_launcher.sh ios $RYZOM_PATH/../build/bin/ryzom_ios_service -C. -L. --nobreak --writepid
# rns # rns
screen -t rns /bin/sh service_launcher.sh rns $RYZOM_PATH/../build/bin/ryzom_naming_service -C. -L. --nobreak --writepid screen -t rns /bin/sh ../tools/scripts/linux/service_launcher.sh rns $RYZOM_PATH/../build/bin/ryzom_naming_service -C. -L. --nobreak --writepid
# rws # rws
screen -t rws /bin/sh service_launcher.sh rws $RYZOM_PATH/../build/bin/ryzom_welcome_service -C. -L. --nobreak --writepid screen -t rws /bin/sh ../tools/scripts/linux/service_launcher.sh rws $RYZOM_PATH/../build/bin/ryzom_welcome_service -C. -L. --nobreak --writepid
# ts # ts
screen -t ts /bin/sh service_launcher.sh ts $RYZOM_PATH/../build/bin/ryzom_tick_service -C. -L. --nobreak --writepid screen -t ts /bin/sh ../tools/scripts/linux/service_launcher.sh ts $RYZOM_PATH/../build/bin/ryzom_tick_service -C. -L. --nobreak --writepid
# ms # ms
screen -t ms /bin/sh service_launcher.sh ms $RYZOM_PATH/../build/bin/ryzom_mirror_service -C. -L. --nobreak --writepid screen -t ms /bin/sh ../tools/scripts/linux/service_launcher.sh ms $RYZOM_PATH/../build/bin/ryzom_mirror_service -C. -L. --nobreak --writepid
# ais_newbyland # ais_newbyland
screen -t ais_newbyland /bin/sh service_launcher.sh ais_newbyland $RYZOM_PATH/../build/bin/ryzom_ai_service -C. -L. --nobreak --writepid -mCommon:Newbieland:Post screen -t ais_newbyland /bin/sh ../tools/scripts/linux/service_launcher.sh ais_newbyland $RYZOM_PATH/../build/bin/ryzom_ai_service -C. -L. --nobreak --writepid -mCommon:Newbieland:Post
# mfs # mfs
screen -t mfs /bin/sh service_launcher.sh mfs $RYZOM_PATH/../build/bin/ryzom_mail_forum_service -C. -L. --nobreak --writepid screen -t mfs /bin/sh ../tools/scripts/linux/service_launcher.sh mfs $RYZOM_PATH/../build/bin/ryzom_mail_forum_service -C. -L. --nobreak --writepid
# su # su
screen -t su /bin/sh service_launcher.sh su $RYZOM_PATH/../build/bin/ryzom_shard_unifier_service -C. -L. --nobreak --writepid screen -t su /bin/sh ../tools/scripts/linux/service_launcher.sh su $RYZOM_PATH/../build/bin/ryzom_shard_unifier_service -C. -L. --nobreak --writepid
# fes # fes
screen -t fes /bin/sh service_launcher.sh fes $RYZOM_PATH/../build/bin/ryzom_frontend_service -C. -L. --nobreak --writepid screen -t fes /bin/sh ../tools/scripts/linux/service_launcher.sh fes $RYZOM_PATH/../build/bin/ryzom_frontend_service -C. -L. --nobreak --writepid
# sbs # sbs
screen -t sbs /bin/sh service_launcher.sh sbs $RYZOM_PATH/../build/bin/ryzom_session_browser_service -C. -L. --nobreak --writepid screen -t sbs /bin/sh ../tools/scripts/linux/service_launcher.sh sbs $RYZOM_PATH/../build/bin/ryzom_session_browser_service -C. -L. --nobreak --writepid
# lgs # lgs
screen -t lgs /bin/sh service_launcher.sh lgs $RYZOM_PATH/../build/bin/ryzom_logger_service -C. -L. --nobreak --writepid screen -t lgs /bin/sh ../tools/scripts/linux/service_launcher.sh lgs $RYZOM_PATH/../build/bin/ryzom_logger_service -C. -L. --nobreak --writepid
# mos # mos
#screen -t mos /bin/sh service_launcher.sh mos $RYZOM_PATH/../build/bin/ryzom_monitor_service -C. -L. --nobreak --writepid #screen -t mos /bin/sh ../tools/scripts/linux/service_launcher.sh mos $RYZOM_PATH/../build/bin/ryzom_monitor_service -C. -L. --nobreak --writepid
# pdss # pdss
#screen -t pdss /bin/sh service_launcher.sh pdss $RYZOM_PATH/../build/bin/ryzom_pd_support_service -C. -L. --nobreak --writepid #screen -t pdss /bin/sh ../tools/scripts/linux/service_launcher.sh pdss $RYZOM_PATH/../build/bin/ryzom_pd_support_service -C. -L. --nobreak --writepid
# ras # ras
screen -t ras /bin/sh service_launcher.sh ras $RYZOM_PATH/../build/bin/ryzom_admin_service --fulladminname=admin_service --shortadminname=AS -C. -L. --nobreak --writepid screen -t ras /bin/sh ../tools/scripts/linux/service_launcher.sh ras $RYZOM_PATH/../build/bin/ryzom_admin_service --fulladminname=admin_service --shortadminname=AS -C. -L. --nobreak --writepid
# switch back to AES screen
select 0

View file

@ -4,7 +4,7 @@ CMD=$1
#DOMAIN=$(pwd|sed s%/home/nevrax/%%) #DOMAIN=$(pwd|sed s%/home/nevrax/%%)
DOMAIN=shard DOMAIN=shard
if [ "$CMD" == "" ] if [ "$CMD" = "" ]
then then
echo echo
echo Screen sessions currently running: echo Screen sessions currently running:
@ -21,68 +21,74 @@ then
read CMD read CMD
fi fi
if [ "$CMD" == "stop" ] if [ "$CMD" = "stop" ]
then then
if [ $(screen -list | grep \\\.${DOMAIN} | wc -l) != 1 ] if [ $(screen -list | grep \\\.${DOMAIN} | wc -l) != 1 ]
then then
echo Cannot stop domain \'${DOMAIN}\' because no screen by that name appears to be running echo Cannot stop domain \'${DOMAIN}\' because no screen by that name appears to be running
screen -list screen -list
else else
screen -d -r $(screen -list | grep \\\.${DOMAIN}| sed 's/(.*)//') -X quit> /dev/null screen -d -r $(screen -list | grep \\\.${DOMAIN}| sed 's/(.*)//') -X quit> /dev/null
rm -v */*.state rm -v */*.state
rm -v */*launch_ctrl ./global.launch_ctrl rm -v */*launch_ctrl ./global.launch_ctrl
fi fi
fi fi
STARTARGS= STARTARGS=
if [ "$CMD" == "batchstart" ] if [ "$CMD" = "batchstart" ]
then then
STARTARGS='-d -m' STARTARGS='-d -m'
CMD='start' CMD='start'
fi fi
if [ "$CMD" == "start" ] if [ "$CMD" = "start" ]
then then
ulimit -c unlimited ulimit -c unlimited
screen -wipe > /dev/null screen -wipe > /dev/null
if [ $( screen -list | grep \\\.${DOMAIN} | wc -w ) != 0 ] if [ $( screen -list | grep \\\.${DOMAIN} | wc -w ) != 0 ]
then then
echo Cannot start domain \'${DOMAIN}\' because this domain is already started echo Cannot start domain \'${DOMAIN}\' because this domain is already started
screen -list | grep $DOMAIN screen -list | grep $DOMAIN
else else
screen $STARTARGS -S ${DOMAIN} -c ${DOMAIN}.screen.rc screen $STARTARGS -S ${DOMAIN} -c ${DOMAIN}.screen.rc
fi fi
if [ "$STARTARGS" != "" ]
then
# on "batchstart", AES needs to be launched and AES will then launch other services
printf LAUNCH > aes/aes.launch_ctrl
fi
fi fi
if [ "$CMD" == "join" ] if [ "$CMD" = "join" ]
then then
if [ $(screen -list | grep \\\.${DOMAIN} | wc -l) != 1 ] if [ $(screen -list | grep \\\.${DOMAIN} | wc -l) != 1 ]
then then
echo Cannot join domain \'${DOMAIN}\' because no screen by that name appears to be running echo Cannot join domain \'${DOMAIN}\' because no screen by that name appears to be running
screen -list screen -list
else else
screen -r $(screen -list | grep \\\.${DOMAIN}| sed 's/(.*)//') screen -r $(screen -list | grep \\\.${DOMAIN}| sed 's/(.*)//')
fi fi
fi fi
if [ "$CMD" == "share" ] if [ "$CMD" = "share" ]
then then
if [ $(screen -list | grep \\\.${DOMAIN} | wc -l) != 1 ] if [ $(screen -list | grep \\\.${DOMAIN} | wc -l) != 1 ]
then then
echo Cannot join domain \'${DOMAIN}\' because no screen by that name appears to be running echo Cannot join domain \'${DOMAIN}\' because no screen by that name appears to be running
screen -list screen -list
else else
screen -r -x $(screen -list | grep \\\.${DOMAIN}| sed 's/(.*)//') screen -r -x $(screen -list | grep \\\.${DOMAIN}| sed 's/(.*)//')
fi fi
fi fi
if [ "$CMD" == "state" ] if [ "$CMD" = "state" ]
then then
echo State of domain ${DOMAIN}: echo State of domain ${DOMAIN}:
if [ $(echo */*.state) == "*/*.state" ] if [ "$(echo */*.state)" = "*/*.state" ]
then then
echo - No state files found echo - No state files found
else else
grep RUNNING *state grep RUNNING */*state
fi fi
fi fi

View file

@ -53,7 +53,7 @@ do
CTRL_COMMAND=_$(cat $CTRL_FILE)_ CTRL_COMMAND=_$(cat $CTRL_FILE)_
# do we have a 'launch' command? # do we have a 'launch' command?
if [ $CTRL_COMMAND == _LAUNCH_ ] if [ $CTRL_COMMAND = _LAUNCH_ ]
then then
# update the start counter # update the start counter
@ -90,12 +90,11 @@ do
# we have some kind of relaunch directive lined up so deal with it # we have some kind of relaunch directive lined up so deal with it
mv $NEXT_CTRL_FILE $CTRL_FILE mv $NEXT_CTRL_FILE $CTRL_FILE
else else
# give the terminal user a chance to press enter to provoke a re-launch # give the terminal user a chance to press enter to provoke a re-launch when auto-relaunch in AES is disabled
HOLD=HOLD HOLD=`sh -ic '{ read a; echo "ENTER" 1>&3; kill 0; } | { sleep 2; kill 0; }' 3>&1 2>/dev/null`
read -t2 HOLD if [ "${HOLD}" = "ENTER" ]
if [ _${HOLD}_ != _HOLD_ ] then
then printf LAUNCH > $CTRL_FILE
printf LAUNCH > $CTRL_FILE
fi fi
fi fi