2015-06-08 2 views
0

У меня есть сценарий powershell, который перезапускает веб-сервер Apache на моей машине. Скрипт работает нормально, но журнал сообщает об ошибке. Ошибка, кажется, приходит из Powershell, а не Apache, так как если я вобщеПерезапуск веб-сервера apache из сценария PowerShell (журнал)

.\httpd.exe -k config 

я не получаю никаких ошибок, а первый как

.\http.exe -k restart 

не дает ошибки либо. (примечание: Powershell жалуется на строку # 11, а не # 10 - первый вызов httpd.exe). Я использую powershell V4, в Windows 7.

Итак, я хочу понять, что здесь делает Powershell, так как я считаю, что Apache работает нормально.

Вот сценарий:

# This PowerShell script restarts apache 
start-transcript -Path install.log -Append 
Write-Host "apache.ps1 Script`r`n" 

$sixtyfour = [Environment]::Is64BitProcess 
$exe = "C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin\httpd.exe" 

Write-Host "64-Bit Powershell: "$sixtyfour 
& $exe -k restart *>> install.log 
Write-Host "" 
& $exe -k config *>> install.log 

Вот лог:

httpd.exe : Reconfiguring the Apache2.2 service 
At G:\wwwroot\setup\apache.ps1:11 char:1 
+ & $exe -k config *>> install.log 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (Reconfiguring the Apache2.2 service:String) [], RemoteException 
    + FullyQualifiedErrorId : NativeCommandError 

The Apache2.2 service is successfully installed. 
Testing httpd.conf.... 
Errors reported here must be corrected before the service can be started. 

ответ

Смежные вопросы