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

Fix 'Press ENTER key' functionality

--HG--
branch : shard-script-fixes-for-dash
This commit is contained in:
Nimetu 2014-01-27 23:15:31 +02:00
parent 71b0f9ae92
commit 6f1dc626bd
3 changed files with 69 additions and 60 deletions

View file

@ -16,58 +16,62 @@ hardstatus alwayslastline "%w"
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
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
#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
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
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
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
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
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
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
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
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
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
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
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
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
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
#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
#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
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=shard
if [ "$CMD" == "" ]
if [ "$CMD" = "" ]
then
echo
echo Screen sessions currently running:
@ -21,7 +21,7 @@ then
read CMD
fi
if [ "$CMD" == "stop" ]
if [ "$CMD" = "stop" ]
then
if [ $(screen -list | grep \\\.${DOMAIN} | wc -l) != 1 ]
then
@ -35,13 +35,13 @@ then
fi
STARTARGS=
if [ "$CMD" == "batchstart" ]
if [ "$CMD" = "batchstart" ]
then
STARTARGS='-d -m'
CMD='start'
fi
if [ "$CMD" == "start" ]
if [ "$CMD" = "start" ]
then
ulimit -c unlimited
screen -wipe > /dev/null
@ -52,9 +52,15 @@ then
else
screen $STARTARGS -S ${DOMAIN} -c ${DOMAIN}.screen.rc
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
if [ "$CMD" == "join" ]
if [ "$CMD" = "join" ]
then
if [ $(screen -list | grep \\\.${DOMAIN} | wc -l) != 1 ]
then
@ -65,7 +71,7 @@ then
fi
fi
if [ "$CMD" == "share" ]
if [ "$CMD" = "share" ]
then
if [ $(screen -list | grep \\\.${DOMAIN} | wc -l) != 1 ]
then
@ -76,13 +82,13 @@ then
fi
fi
if [ "$CMD" == "state" ]
if [ "$CMD" = "state" ]
then
echo State of domain ${DOMAIN}:
if [ $(echo */*.state) == "*/*.state" ]
if [ "$(echo */*.state)" = "*/*.state" ]
then
echo - No state files found
else
grep RUNNING *state
grep RUNNING */*state
fi
fi

View file

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