Fix patchman scripts

--HG--
branch : develop
This commit is contained in:
kaetemi 2014-11-07 19:32:18 +01:00
parent ee92cb0702
commit 91ad193104
12 changed files with 62 additions and 69 deletions

View file

@ -99,14 +99,14 @@ then
for f in $DOMAIN_LIST for f in $DOMAIN_LIST
do do
# see if we're setup to run this domain # see if we're setup to run this domain
if [ -e /srv/core/${f}.screen.rc ] && [ -e /srv/core/bin/${f} ] if [ -e /srv/core/${f}.screen.rc ] && [ -e /srv/core/bin/domain_${f} ]
then then
# see whether the domain is alredy running # see whether the domain is alredy running
if [ $( screen -list | grep \( | cut -f2 | cut -d. -f2| grep \^$f\$ | wc -l) == 0 ] if [ $( screen -list | grep \\\.${f} | wc -w ) = 0 ]
then then
# the domain isn't running yet so start it # the domain isn't running yet so start it
echo '****' starting domain: $f '****' echo '****' starting domain: $f '****'
/srv/core/bin/$f batchstart /srv/core/bin/domain_$f batchstart
else else
echo '****' Domain is already running: $f '****' echo '****' Domain is already running: $f '****'
fi fi

View file

@ -3,7 +3,7 @@
while true while true
do do
if [ "$2" == "" ] if [ "$2" = "" ]
then then
echo echo
echo USAGE: $0 sleep_time command_line echo USAGE: $0 sleep_time command_line

View file

@ -10,6 +10,7 @@ do
chmod 775 bin/ps_services 2> /dev/null chmod 775 bin/ps_services 2> /dev/null
chmod 775 bin/run_forever 2> /dev/null chmod 775 bin/run_forever 2> /dev/null
chmod 775 bin/shard 2> /dev/null chmod 775 bin/shard 2> /dev/null
chmod 775 bin/domain_* 2> /dev/null
chmod 775 bin/startup 2> /dev/null chmod 775 bin/startup 2> /dev/null
chmod 775 bin/*.sh 2> /dev/null chmod 775 bin/*.sh 2> /dev/null
chmod 775 patchman/*_service 2> /dev/null chmod 775 patchman/*_service 2> /dev/null

View file

@ -3,8 +3,8 @@
CFGFILENAME=patchman_service.${SERVER_TYPE}.cfg CFGFILENAME=patchman_service.${SERVER_TYPE}.cfg
echo cfg file: $CFGFILENAME echo cfg file: $CFGFILENAME
AESCFGFILENAME=admin_executor_service_default.${SERVER_TYPE}.cfg #AESCFGFILENAME=admin_executor_service_default.${SERVER_TYPE}.cfg
echo aes cfg file: $AESCFGFILENAME #echo aes cfg file: $AESCFGFILENAME
cd /srv/core/patchman cd /srv/core/patchman
if [ -e $CFGFILENAME ] if [ -e $CFGFILENAME ]
@ -15,8 +15,8 @@ if [ -e $CFGFILENAME ]
cp $CFGFILENAME patchman_service.cfg cp $CFGFILENAME patchman_service.cfg
# setup the config file for the admin executor service # setup the config file for the admin executor service
echo Using aes configuration file: $AESCFGFILENAME #echo Using aes configuration file: $AESCFGFILENAME
if [ -e $AESCFGFILENAME ] ; then cp $AESCFGFILENAME admin_executor_service_default.cfg ; fi #if [ -e $AESCFGFILENAME ] ; then cp $AESCFGFILENAME admin_executor_service_default.cfg ; fi
# start the patchman service # start the patchman service
echo Launching patchman... echo Launching patchman...

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
if [ "$1" == "" ] if [ "$1" = "" ]
then then
echo echo
echo USAGE: $0 command_line echo USAGE: $0 command_line

View file

@ -84,7 +84,7 @@ rm -v */*.*launch_ctrl *.*launch_ctrl 2> /dev/null
# initialise the state files for the new services to "xxxxx" and remove directories that are no longer of interest # initialise the state files for the new services to "xxxxx" and remove directories that are no longer of interest
for D in $(ls */log.log | sed "s%/.*%%" | sort -u) for D in $(ls */log.log | sed "s%/.*%%" | sort -u)
do do
if [ $(grep \"$D\" admin_executor_service.cfg | wc -l) == 1 ] if [ $(grep \"$D\" admin_executor_service.cfg | wc -l) = 1 ]
then then
printf "xxxxx" > $D/$D.state printf "xxxxx" > $D/$D.state
else else
@ -97,7 +97,7 @@ done
printf "1" > ./global.launch_ctrl printf "1" > ./global.launch_ctrl
# create a script for accessing the screen for this shard # create a script for accessing the screen for this shard
SCRIPT_FILE=/srv/core/bin/${DOMAIN} SCRIPT_FILE=/srv/core/bin/domain_${DOMAIN}
echo "#!/bin/sh" > $SCRIPT_FILE echo "#!/bin/sh" > $SCRIPT_FILE
echo "cd "$(pwd) >> $SCRIPT_FILE echo "cd "$(pwd) >> $SCRIPT_FILE
echo '/bin/sh /srv/core/bin/ryzom_domain_screen_wrapper.sh $*' >> $SCRIPT_FILE echo '/bin/sh /srv/core/bin/ryzom_domain_screen_wrapper.sh $*' >> $SCRIPT_FILE

View file

@ -28,10 +28,3 @@ StartCommands =
"pam.plug spm_gw", "pam.plug spm_gw",
"pam.plug bridge_gw", "pam.plug bridge_gw",
}; };
SpaPreCmdLineText="/bin/sh /srv/core/patchman/service_launcher.sh";
DeploymentRootDirectory="/srv/core/patchman/";
MakeInstalledVersionLiveCmdLine="/bin/sh /srv/core/patchman/make_next_live.sh";
SpaLaunchAESCmdLine="/bin/sh /srv/core/patchman/loop_aes.sh";
InstallArchiveDirectory="/srv/core/";
InstallArchiveFileName="admin_install.tgz";

View file

@ -36,10 +36,3 @@ StartCommands =
"pam.plug spm_gw", "pam.plug spm_gw",
"pam.plug bridge_gw", "pam.plug bridge_gw",
}; };
SpaPreCmdLineText="/bin/sh /srv/core/patchman/service_launcher.sh";
DeploymentRootDirectory="/srv/core/patchman/";
MakeInstalledVersionLiveCmdLine="/bin/sh /srv/core/patchman/make_next_live.sh";
SpaLaunchAESCmdLine="/bin/sh /srv/core/patchman/loop_aes.sh";
InstallArchiveDirectory="/srv/core/";
InstallArchiveFileName="admin_install.tgz";

View file

@ -36,10 +36,3 @@ StartCommands =
"pam.plug spm_gw", "pam.plug spm_gw",
"pam.plug bridge_gw", "pam.plug bridge_gw",
}; };
SpaPreCmdLineText="/bin/sh /srv/core/patchman/service_launcher.sh";
DeploymentRootDirectory="/srv/core/patchman/";
MakeInstalledVersionLiveCmdLine="/bin/sh /srv/core/patchman/make_next_live.sh";
SpaLaunchAESCmdLine="/bin/sh /srv/core/patchman/loop_aes.sh";
InstallArchiveDirectory="/srv/core/";
InstallArchiveFileName="admin_install.tgz";

View file

@ -14,4 +14,9 @@ DontUseStdIn = 0;
// 4 = nothing // 4 = nothing
UseYieldMethod = 0; UseYieldMethod = 0;
SpaPreCmdLineText="/bin/sh /srv/core/patchman/service_launcher.sh";
DeploymentRootDirectory="/srv/core/patchman/";
MakeInstalledVersionLiveCmdLine="/bin/sh /srv/core/patchman/make_next_live.sh";
SpaLaunchAESCmdLine="/bin/sh /srv/core/patchman/loop_aes.sh";
InstallArchiveDirectory="/srv/core/";
InstallArchiveFileName="admin_install.tgz";

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# the object is to make a launcher script that works with a command file to determine when to launch the application that it is responsible for # the objective is to make a launcher script that works with a command file to determine when to launch the application that it is responsible for
DOMAIN=$(pwd |sed "s%/srv/core/%%" | sed "s%/.*%%") DOMAIN=$(pwd |sed "s%/srv/core/%%" | sed "s%/.*%%")
NAME_BASE=$(pwd | sed 's/\/srv\/core\///' | sed 's/^.*\///') NAME_BASE=$(pwd | sed 's/\/srv\/core\///' | sed 's/^.*\///')
@ -20,6 +20,7 @@ NAME_BASE=$(pwd | sed 's/\/srv\/core\///' | sed 's/^.*\///')
STATE_FILE=${NAME_BASE}.state STATE_FILE=${NAME_BASE}.state
START_COUNTER_FILE=${NAME_BASE}.start_count START_COUNTER_FILE=${NAME_BASE}.start_count
CTRL_CMDLINE=$* CTRL_CMDLINE=$*
CTRL_COMMAND=""
echo echo
echo --------------------------------------------------------------------------------- echo ---------------------------------------------------------------------------------
@ -36,6 +37,13 @@ echo
echo 0 > $START_COUNTER_FILE echo 0 > $START_COUNTER_FILE
START_COUNTER=0 START_COUNTER=0
# always give ras a first run
if [ "${NAME_BASE}" = "ras" ]
then
echo Force admin service first startup
printf LAUNCH > $CTRL_FILE
fi
echo Press ENTER to launch program echo Press ENTER to launch program
while true while true
do do
@ -45,10 +53,10 @@ do
then then
# a control file exists so read it's contents # a control file exists so read it's contents
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
@ -87,7 +95,7 @@ do
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
HOLD=`sh -ic '{ read a; echo "ENTER" 1>&3; kill 0; } | { sleep 2; kill 0; }' 3>&1 2>/dev/null` HOLD=`sh -ic '{ read a; echo "ENTER" 1>&3; kill 0; } | { sleep 2; kill 0; }' 3>&1 2>/dev/null`
if [ _${HOLD}_ != _HOLD_ ] if [ "${HOLD}" = "ENTER" ]
then then
printf LAUNCH > $CTRL_FILE printf LAUNCH > $CTRL_FILE
fi fi