Initial import
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$root = $PSScriptRoot
|
||||
$php = 'C:\xampp\php\php.exe'
|
||||
$mysql = 'C:\xampp\mysql\bin\mysqld.exe'
|
||||
$logDir = Join-Path $root 'logs'
|
||||
New-Item -ItemType Directory -Path $logDir -Force | Out-Null
|
||||
|
||||
if (-not (Get-NetTCPConnection -State Listen -LocalPort 3306 -ErrorAction SilentlyContinue)) {
|
||||
Start-Process -FilePath $mysql -WorkingDirectory 'C:\xampp\mysql\bin' -WindowStyle Hidden
|
||||
Start-Sleep -Seconds 5
|
||||
}
|
||||
|
||||
$servers = @(
|
||||
@{ Name='register'; Port=8081; WorkDir=(Join-Path $root 'register_unpacked\trunk'); Args=@('-S','127.0.0.1:8081','-t','web','web/index.php') },
|
||||
@{ Name='register-api'; Port=8082; WorkDir=(Join-Path $root 'register_unpacked\trunk'); Args=@('-S','127.0.0.1:8082','-t','api','api/index.php') },
|
||||
@{ Name='portal'; Port=8083; WorkDir=(Join-Path $root 'marko_unpacked\marko\portal'); Args=@('-S','127.0.0.1:8083','-t','.','index.php') },
|
||||
@{ Name='cms'; Port=8084; WorkDir=(Join-Path $root 'marko_unpacked\marko\cms'); Args=@('-S','127.0.0.1:8084','-t','.','index.php') }
|
||||
)
|
||||
|
||||
foreach ($server in $servers) {
|
||||
if (Get-NetTCPConnection -State Listen -LocalPort $server.Port -ErrorAction SilentlyContinue) {
|
||||
Write-Host "$($server.Name) already running on http://127.0.0.1:$($server.Port)"
|
||||
continue
|
||||
}
|
||||
|
||||
Start-Process `
|
||||
-FilePath $php `
|
||||
-ArgumentList $server.Args `
|
||||
-WorkingDirectory $server.WorkDir `
|
||||
-RedirectStandardOutput (Join-Path $logDir "$($server.Name).out.log") `
|
||||
-RedirectStandardError (Join-Path $logDir "$($server.Name).err.log") `
|
||||
-WindowStyle Hidden | Out-Null
|
||||
|
||||
Write-Host "Started $($server.Name) on http://127.0.0.1:$($server.Port)"
|
||||
}
|
||||
Reference in New Issue
Block a user