Single batch file to start & stop Apache2 / Mysql servic

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

Is there a way I could have a single batch file check if my Apache2 service is running & if it is then stop that service & the Mysql service, but if it's not running then start both services ?

I've figured out how to get two batch files to do it with "NET START/STOP", but I'd like to just have a single icon in my taskbar I can click to toggle the state of thoose two services.
  • grinch2171
  • Moderator
  • Genius
  • User avatar
  • Posts: 6810
  • Loc: Martinsburg, WV

Post 3+ Months Ago

You can combine net stop and start into one line

net stop servicename && net start servicename
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

I had to use or instead of and, but it works.

Thanks grinch ! :D

Code: [ Select ]
NET STOP Apache2 || NET START Apache2
NET STOP Mysql5 || NET START Mysql5
  1. NET STOP Apache2 || NET START Apache2
  2. NET STOP Mysql5 || NET START Mysql5
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

After 5 days, it's working fine.
It takes me about 10 seconds to start/stop the services instead of about a minute by going through services.msc or the Apache server monitor, & I don't have to keep the monitor running in the background.
I checked event viewer, the only thing in there are notices about mysql starting & stopping, I was wondering if the || (or) would show application errors but that's not the case. :D
  • webdiver
  • Born
  • Born
  • webdiver
  • Posts: 2

Post 3+ Months Ago

Hi joebert.

I try to find 1 batch (*.bat) file script for start/stop/restart Apache-MySQL-PHP from flash drive without install using only Win-NT CMD batch engine resources and i found this ! :)

Link to Daemonscript v1.0 for Apache-MySQL-PHP Win-NT manage using 1 batch file:

http://sourceforge.net/projects/daemonscript/

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 38 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.