logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: How to start Apache in the background with batch files?
Author
Lisa Grant



Joined: 01 Dec 2012
Posts: 1
Location: USA

PostPosted: Sat 01 Dec '12 21:11    Post subject: How to start Apache in the background with batch files? Reply with quote

I'm trying to create a batch file that lets me start Apache and MySQL on demand.

Code:

@echo off
cls

cd apache/bin
start "httpd.exe" /B /MIN "httpd.exe"
cd ../..

cd mysql/bin
start "mysqld.exe" /B /MIN "mysqld.exe"
cd ../..


Both Apache and MySQL start just fine but the window hangs at the end. If I click the close button on the window, MySQL sticks around but Apache is terminated. If I comment out the 'start "httpd.exe"' line, MySQL is started and then the console window closes immediately. I'm not sure what is going on. Since MySQL starts in the background, I'd think Apache would too.

I'm running the latest Apache Lounge binaries (2.4.3) and latest MySQL binaries (5.5.28) under Windows 7.

Any help/suggestions will be appreciated.
Back to top
rhossis



Joined: 30 Mar 2011
Posts: 9

PostPosted: Mon 03 Dec '12 8:58    Post subject: Reply with quote

Hi,

I suspect you should run this batch script by creating a local user account whose credentials you will then use to execute it; and not your main windows account which you log in with, to enable it to run in the background.

We have done this with PHP in a number of instances where we need to call PHP scripts in background on schedule to emulate cron jobs.

Regards
Back to top
rhossis



Joined: 30 Mar 2011
Posts: 9

PostPosted: Mon 03 Dec '12 9:56    Post subject: Reply with quote

Correction, option in first reply is not valid answer for this problem. It is when running scheduled task in background

Idea After trying i searched it, it seems that you should replace
Code:
start "httpd.exe" /B /MIN "httpd.exe"


with

Code:
httpd -k start


Re: http://tinyurl.com/d63huvp
Back to top


Reply to topic   Topic: How to start Apache in the background with batch files? View previous topic :: View next topic
Post new topic   Forum Index -> Apache