Changeset 12 for trunk/www/server.php
- Timestamp:
- Jun 11, 2009, 9:37:46 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/server.php
r11 r12 11 11 var $WorlddBaseNetworkPort = 8085; 12 12 var $RealmdBaseNetworkPort = 3724; 13 var $MangosWorlddThreadCountMax = 12; 13 14 14 15 function __construct($Database, $Id) … … 86 87 { 87 88 $this->AddTask('Start emulátoru', array( 88 'screen -A -m -d -S server'.$this->Id.'-realmd "emulator/'.$this->Server['Database']['Emulator']['Id'].'/bin/mangos-realmd -c server/'.$this->Id.'/etc/realmd.conf"',89 'screen -A -m -d -S server'.$this->Id.'-worldd "emulator/'.$this->Server['Database']['Emulator']['Id'].'/bin/mangos-worldd -c server/'.$this->Id.'/etc/mangosd.conf"',89 'screen -A -m -d -S server'.$this->Id.'-realmd emulator/'.$this->Server['Database']['Emulator']['Id'].'/bin/mangos-realmd -c server/'.$this->Id.'/etc/realmd.conf"', 90 'screen -A -m -d -S server'.$this->Id.'-worldd server/'.$this->Id.'/bin/start.sh', 90 91 )); 91 92 return('Požadavek na start serveru zařazen.'); … … 95 96 { 96 97 $this->AddTask('Zastavení emulátoru', array( 97 'ps -ef | grep \'SCREEN -A -m -d -S server'.$this->Id.'-realmd\' | grep -v grep | awk \'{print $2}\' | xargs -i kill {}', 98 'ps -ef | grep \'SCREEN -A -m -d -S server'.$this->Id.'-worldd\' | grep -v grep | awk \'{print $2}\' | xargs -i kill {}', 98 'server/'.$this->Id.'/bin/stop.sh', 99 99 )); 100 100 return('Požadavek na zastavení serveru zařazen.'); … … 152 152 $this->SetupConfigurationFiles(); 153 153 $this->UpdateRealmlist(); 154 $this->UpdateScripts(); 155 } 156 157 function UpdateScripts() 158 { 159 $ServerBinDir = '../server/'.$this->Id.'/bin/'; 160 if(!file_exists($ServerBinDir)) mkdir($ServerBinDir, 0777, true); 161 162 // GDB script 163 $ScriptFileName = '../server/'.$this->Id.'/bin/mangos.gdb'; 164 $Content = array 165 ( 166 'run -c server/'.$this->Id.'/etc/realmd.conf', 167 'info thread', 168 ); 169 for($I = 1; $I < $this->MangosWorlddThreadCountMax; $I++) 170 $Content[] = 'thread apply '.$I.' bt full'; 171 file_put_contents($ScriptFileName, implode("\n", $Content)); 172 chmod($ScriptFileName, 0666); 173 174 // Start script 175 $ScriptFileName = '../server/'.$this->Id.'/bin/start.sh'; 176 $Content = array 177 ( 178 '#!/bin/sh', 179 'while [ 1=1 ] ; do', 180 'gdb emulator/'.$this->Id.'/bin/mangos-realmd -x mangos.gdb --batch >>server/'.$this->Id.'/log/mangos-worldd.log 2>>server/'.$this->Id.'/log/mangos-worldd.err', 181 'cd www', 182 'php mangos_debug_process.php '.$this->Id.' >>server/'.$this->Id.'/log/mangos_debug.log 2>>server/'.$this->Id.'/log/mangos_debug.err', 183 'cd ..', 184 'sleep 3', 185 'done', 186 ); 187 file_put_contents($ScriptFileName, implode("\n", $Content)); 188 chmod($ScriptFileName, 0777); 189 190 // Stop script 191 $ScriptFileName = '../server/'.$this->Id.'/bin/stop.sh'; 192 $Content = array 193 ( 194 '#!/bin/sh', 195 'ps -ef | grep \'SCREEN -A -m -d -S server'.$this->Id.'-realmd\' | grep -v grep | awk \'{print $2}\' | xargs -i kill {}', 196 'ps -ef | grep \'SCREEN -A -m -d -S server'.$this->Id.'-worldd\' | grep -v grep | awk \'{print $2}\' | xargs -i kill {}', 197 ); 198 file_put_contents($ScriptFileName, implode("\n", $Content)); 199 chmod($ScriptFileName, 0777); 154 200 } 155 201
Note:
See TracChangeset
for help on using the changeset viewer.