masterio
Sep 22 2006, 02:14 PM
Hi guys, this is a litte tutorial about how we start and stop the Apache and MySQL in Windows NT (2000, XP, 2003) via a batch file script. As we know in Windows NT based system Apache and MySQL installed as Windows Services. So we can stop and start it using NET command. For more information about DOS command, type HELP at command prompt. I assuming that your MySQL service name is "mysql" and your Apache (Apache 2.0.x) service name is "apache2". If you want to chek it click Start > Run > services.msc > OK. Windows IS NOT Case Sensitive. Let's get started!. 1. Open your command prompt by clicking Start > Run > cmd > OK 2. Type edit then press ENTER to start the EDIT program. 3. Type code below CODE @ECHO OFF
if "%1"=="start" goto start_server if "%1"=="stop" goto stop_server if "%1"=="" goto begin
:begin TITLE ::BATCH SCRIPT:: ECHO ---------------------------------------------------------------------------------- ECHO USAGE OF THIS SCRIPT: ECHO server.bat option1 [option2] ECHO WHERE option1 = start/stop (start or stopping server) ECHO option2 = yes/no (close the command prompt or not [optional]) ECHO ----------------------------------------------------------------------------------- goto end
:start_server TITLE ACTIVATING SERVER... ECHO ================================================= ECHO BATCH SCRIPT FOR ACTIVATING SERVER ECHO By Rio Astamal (masterio.trap17.com) ECHO ================================================= ECHO _ ECHO Activating MySQL Service . . . @NET START mysql ECHO _ ECHO Activating Apache HTTP Server Service. . . @NET START apache2 ECHO _ ECHO SERVER HAS BEEN STARTED! DATE /T TIME /T goto end
:stop_server TITLE STOPPING SERVER... ECHO ================================================== ECHO BATCH SCRIPT FOR STOPPING SERVER ECHO By Rio Astamal (masterio.trap17.com ECHO ================================================== ECHO _ ECHO Stopping Apache HTTP Server Service... @NET STOP apache2 ECHO _ ECHO Stopping MySQL Service. . . @NET STOP ECHO SERVER HAS BEEN SHUTTING DOWN! DATE /T TIME /T goto end
:end if "%2"=="yes" ( exit ) To save the file: 1. Press ALT-F > Save 2. Go to your Windows Directory, so we can start it from anywhere in command prompt 3. OK Usage: C:\>server.bat (to show the usage of the script) C:\>server.bat stop yes (close the command prompt after finished the task) C:\>server.bat start EXPLAINATION:If you create a batch file, Anything inside it is assumed as DOS command by command prompt. In that script, first, we make the ECHO command invisible by using @ECHO OFF command. Then we check the argument given by user. %1 is argument 1, %2 is argument 2 and so on. We use first argument(%1) to check what user want. Is he want to stop/start the server. We use argument2 (%2) to check wheter we close the command prompt or not after it. TITLE is used for changing the title of command prompt title bar. For starting service We can use NET START [service_name]. In our script we use @NET START to prevent DOS for echoing the command. For stopping service we can use NET STOP [service_name]. SUMMARYWith a batch file we can do alot of thing not just stop/starting service. But we can use it for renaming many files at once, deleting temporer directory and many more. For more tutorial you can googling!!. ENJOY...! 
Comment/Reply (w/o sign-up)
Similar Topics
Keywords : Starting Stopping Apache Mysql Server Batch File- How To Make Your Own Counter Strike Source Dedicated Server!
- (67)
Ok, so you want to host your own CSS Server on your computer eh? Well you will not need a lot of
things, and it is very simple. All you will need is time. /biggrin.gif"
style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> I did this tutorial
myself, from my experience when I made my own CSS Server. This is just a simple tutorial! It ONLY
covers the basics of making a CSS server! Lets Get Started! /laugh.gif"
style="vertical-align:middle" emoid=":lol:" border="0" alt="laugh.gif" /> 1. Download the HLDS
Update Tool from here . 2. Once it is dow...
Install Php 5 To Work With Mysql
- (1)
hi, all php 5 is new to all people a long time( actually, I forget how long...). it introduced a
more object-oriented design to developer. like, access type(public, private, protected), abstract
type(classes that can't create objects), interface support, and more . althrought it is
widerly available, someone still can't get it running with mysql. every time the php is starting
up. a message prompted stated that some xtensions can not be found, and therefore, not loaded. so, I
have written this to help other and newbie get it start quickly. note: thi...
Starting Your Own Clan
- (23)
Tutorial:Starting A Clan Clans Can Start By People Who Love To Chat And Have Fun. Or Clans Can
Start By People Who Think They Need To Boss People. Here Is A Tutorial For Running A Clan. I Am A
Clan Leader Myself Leading 13th Airborne. This Tutorial May Help You Alot. 1.) Starting A Clan
So You Want To Start A Clan Right? Well It Takes Alot of Work To Start A Clan. A Clan Must Start By
A Active Person Who Loves To Help People In Many Ways. Many Clans Like uBp Runs Very Nice Because
They Recruit. You Need To Recruit. But Becareful Who You Recruit. 13th Airborne Near...
Check Referrer To Prevent Linking Yours From Other Sites
- Check referrer with Php and Mysql (9)
Check Referrer Using Php To Prevent People Linking To Your Downloads From Other Sites Ever
find that found some people are listing items, images and tuts and linking directly to the download
url (those that are like my photoshop tutorial.php?id=0), which is a .php to count the number of
downloads. To prevent this, you can add a piece of code to the download pages that checks which page
referred them to the download page: if it's my domain, it downloads the file normally, if
it's not, it will redirect to my home page instead. Important : Not all browser...
Php/mysql Login/register
- Tutorial for login with databases. (4)
Start register code. Register.php CODE Username: Email: Pass: Verify
Pass: //Login to your database. Make the fields of course..
mysql_connect("localhost","user","pass"); mysql_select_db("database"); //end //if registering,
check fields. if ($action == register) { if (!$user || !$pass || !$email || !$vpass) { print
"You must fill out all fields."; exit; } $dupe1 = mysql_num_rows(mysql_query("select * from
table where user='$user'")); if ($dupe1 > 0) { print "Someone already has that
username."; exit...
Clicks Counter
- With PHP + MySQL (1)
Well, in this tut, I'll show you how to do an simple link counter, with only one count for each
IP and the date when the link were clicked. Just remember, this is only one way to do it. First,
create an mysql database called 'links', with 2 table: first table will be called
'links', with the columns: id, title, ref and clicks. The other one will be 3 columns and
will be called links_info: id, ip and date. Just remember that the columns 'id' of this
second table IS NOT auto-increment. Here is the code of the file which will count the clicks, ...
Simple User System
- php, mysql driven (21)
Hey! Maybe you've seen my other tutorials...or my signature.. Anyways I'm going to show you
how to make a system so users of your site could register accounts and you could have protected -
user only - pages on your site /smile.gif" style="vertical-align:middle" emoid=":)" border="0"
alt="smile.gif" /> Ok, so we start by creating a config.php file. CODE $dbhost =
'database host'; $dbname = 'database name'; $dbusername = 'database
username'; $dbuserpass = 'database password'; mysql_connec...
How To Create Pdf Files Using Free Tool
- Introduction to use a free tool to create PDF file (10)
Now, that you don't need to have expensive software like Acrobat to create PDF. All you need is
Microsoft Office and a software name doPDF. You can download the freeware from
http://www.dopdf.com/download.php After downloading dopdf.exe, follow the instruction below 1.
Double click to install it, as display at image 1.jpg, choose a language and click OK 2. You will
see 2.jpg click next 3. Click I accept the agreement see 3.jpg, click next 4. Now you will see
4.jpg, select the folder to install it and click next 5. When seeing 5.jpg, This is the folder group
in Star...
Make A Moderately-secure Password System Using Javascript
- using file redirection to hide the password. (11)
JavaScript is very handy at making forms, allowing for much more customization and easier ways to
send data. So making Login forms using JavaScript may seem to many to be a very feasable idea.
However, JavaScript is very bad at protecting Passwords, as since the passwords are not encypted and
the whole JavaScript code is in the page, a person could just view the Page Source and find out
everything. Even if you use an external JavaScript, it would still be poor as the file name for the
external JavaScript would still be revealed. But I have an answer! There is a relative...
Rfi (remote File Inclusion) What Is It? How Do I Stop It?
- Another website security tutorial (0)
How To Extract The Audio From Youtube Videos
- get an mp3 file from youtube (6)
How To Extract The Audio From YouTube Videos This lovely simple tutorial will tell you how
to extract the audio from YouTube videos. Obviously , I am not in any way advocating that you take
copyrighted music that is available illegally in video-form on YouTube and extract the audio from
those videos rather than going down to HMV and buying the music. In this tutorial I will be using
the following video: http://uk.youtube.com/watch?v=gUhhRc5eWNw Firstly, you download the video,
which is simple. Just go to www.downloadyoutubevideos.com and paste the video...
How To: Change Your Website's Index File
- a simple trick using .htaccess (24)
How To: Change Your Website's Index File a simple trick using the .htaccess file A simple
tutorial which only involves editing one little file. Useful for those of us who have mime-typed
extensions or who are creating lots of test design files and want an easy way to make the design
they like best their default file. Create a file called .htaccess in the /public_html/ folder if
you don't have it. I think one should be there already when you get your site so if it isn't
you should create it anyway! In the file write the following: CODE Direct...
Complete Login System
- With PHP + MYSQL (57)
Its an complete login sistem made and tested by me and I think itwill be very usefull for people who
are tryn to learn PHP. First, let's make register.php: CODE include("conn.php"); //
create a file with all the database connections if($do_register){ // if the submit button were
clicked if((!$name) || (!$email) || (!$age) || (!$login) || (!$password) || (!$password2)){ print
"You can't let any fields in blank.\n"; // if the user did not put some field exit; } $name =
stripslashes($name); $email = stripslashes($email); $age = stripslashes($age); $login = s...
Transfer File Of Any Size Using Winsock Control
- Winsock Help (5)
This tutorial shows how to transfer file of any size using winsock control. - Open VB; - Select
standard exe; - Press Ctrl + t to show the add component window; - Select winsock control and
microsoft common dialog; - Add one winsock control in the project; - Name it winsock1; - If you want
to add chat then add another winsock and name it winsock2; - Insert another winsock object if you
want to add chat also; - Add a microsoft common dialog box; - Name it cd; - We will use this
winsock1 object to transfer the file and winsock2 for chat; ------------- The basic idea : ...
Debug Exe Files
- How to debug an exe file. (4)
Think that we have written a program, and some codes are wrong. We can go back to compiler and
change the code, and compile again. But I will show you how to correct our mistakes without using
the compiler. Let's start: I have written a program in Delphi. Let's see my mistake. I
have created a form like this. After this I wrote the codes in the Compare Button click as
below. CODE 1. procedure TForm1.ComparebuttonClick(Sender: TObject); 2. var 3.
a,b:integer; 4. begin 5. a := StrToInt(EditA.Text); 6. b := StrToInt(EditB.Text); 7. 8. ...
How To: Make A Simple Php Site
- Making one file show up on all pages using php (21)
I have looked all over the site and could not find anything that was like this simple, or just like
this at all.. For some people i know that you are using a basic HTML site...and having a big menu
if you want to add somthing you have to go into every one of the pages and add or remove or edit
what you want to do, but with somthing verry simple all you would have to do is edit one file, and
all of the pages that have the PHP script on them would suddenly change to what that one file is.
So to start off if you are planning on using this little tirck, the page that you a...
Install An Aef Forum Onto The Trap17
- From a zip file (11)
Installing an AEF Forum on the Trap17 Server Preparation for Installing the AEF Forum
The following items are required for the installation of the packaage onto your site: 1. - a copy
of the AEF Forum zip package from http://anelectron.com/download.php 2. - a MySql Database 3. - a
Database User 4. - a password for the Database User 5. - Privileges allowed for the Database User
The details for ensuring that you have all of these items are as follows: 1. - a copy of the AEF
Forum zip package from http://anelectron.com/download.php . Simply browse to t...
Flat-file Cms
- tutorial inspired by jlhaslip (4)
Ok, for this tutorial i am only going to show you how to add updates to your site simply by storing
the information into a text file, and then displaying it with predefined formatting... OK lets get
down to business... Lets start out by making a PHP file and call it mycms.php put this code at
the top of the page. What this will do is allow us to edit the selected update when it comes time
and show and hide the add an update field and validate the form.. function ShowHide(id1,
id2) { if (id1 != '') expMenu(id1); if (id2 != '') expMenu(i...
Getting Started With Mysql
- creating tables and insert data into them. (2)
Hi in this tutorial you will learn how to create tables and insert items into them. First steps are
to create the database - go into your cpanel and mysql databases, from there make an account and a
database and then attach them together with all priviliges, call the database test and the account
admin, with the pw as pass - or any other password. We need to connect to the database so first in
your php file (probably named index.php) - this is how to do it. CODE
mysql_connect("localhost", "admin", "pass") or die(mysql_error()); mysql_select_db("test") or
die(mysql_...
Installing Apache And Php
- Need help? (2)
First of all you will need Apache httpd server. Go to this link for download And then follow the
images to help you. 1. Go to the link and scroll down to find this bit. Then download. 2.
Continue through the process. 3. When it is completed the installation you may have found this in
your start menu. 4. Go in to "Configure Apache Server" and click "Test Configuration" 5. If all
goes well, ms dos should close within a second. 6. Now to install php. 7. Go to this link and
follow the image. 8. Just click the installer as you will not need most of the func...
Server Status
- MAke Your own server status in PHP (12)
My Friend and i made an mmorpg we decided to make a code so the users could tell when the game
server was running this codoe has many other uses to like monitor a website or w/e you want to do.
CODE $ip = "youriphere"; $port = "yourporthere"; if (! $sock = @fsockopen($ip, $port, $num,
$error, 5)) echo ' Offline '; else{ echo ' Online '; fclose($sock); } ?>
-open a text editor like notepad -Put this code in your of index.html or w/e page you are using
-after you finish adding the code make sure you set the port and IP -and when you...
Complete Login And Registration System
- doesn't use mysql! (9)
kLogin 0.1 QUOTE(readme.txt) Readme file to kLogin 0.1 To use the internet explorer fix:
download the latest IE7 ZIP file
(http://sourceforge.net/project/showfiles.php?group_id=109983&package_id=119707) Extract the ie7
zip file to the root directory of your web server. Example, if you are using a unix/linux server,
it's on "public_html/" or "home/public_html" Open kLogin.php file with your editor and edit the
$info_text or $info_txt variable. Then, extract the kLogin.php file in to the root directory of
your web server also. Just run kShoutBox.php If ...
How To Create Counter-strike 1.6 Server In Console Mode
- (5)
Hello! Now I will show you how to create a CS 1.6 Dedicated server /smile.gif"
style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> 1. Locate HLDS.exe. It
could start it from Steam. 2. Make a batch file. You could name it how you like, I writed it as
start.bat. It should be located in the same folder as the HLDS.exe. It should contain something like
this: CODE HLDS.EXE -console -game cstrike -port 27015 +maxplayers 24 +map bl_counterquake
+sv_lan 0 +rcon_password yourrconpass -secure I recommend -console to be there, couse it starts
hlds.ex...
Adding Data To A Database And Displaying It Later
- Using Forms, PHP and MySQL (1)
Requirements: PHP Support MySQL Database access I am going to use a news program as an example.
Ok, first you are going to need to connect to the database. Do so by using the code below. I have
added some comments where you will need to edit to fit your server's specifications. Create a
new file with notepad and call it config.php QUOTE //Change root to your database
account's username $dbusername = "root"; //Add your account's password in between the
quotations $password = " "; //Add the name of the database you are using in between the qu...
Simple Shoutbox
- PHP, MySQL driven.. (34)
Ok, so I'm going to show you how to create a very basic shoutbox which is driven with PHP and a
MySQL database. So, lets start - open a database management program like PHPMyAdmin and run these
queries. SQL CREATE TABLE `shoutbox` ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT , `name`
VARCHAR( 255 ) NOT NULL , `mail` VARCHAR( 255 ) NOT NULL , `time` VARCHAR( 255 ) NOT NULL ,
`message` TEXT NOT NULL , `ip` VARCHAR( 255 ) NOT NULL , PRIMARY KEY ( `id` ) ) TYPE = MYISAM ;
CREATE TABLE `shoutbox_admin` ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT , `name` VARCHAR( 255...
How To Make A Simple File Based Shoutbox Using Php And Html
- (8)
A simple tut to make a simple shoutbox. Let me jump right in. First of all you need the standard
equipment for PHP, an IDE like XAMPP and an editor like PHP EDITOR 2OO7. Were going to make a
simple guestbook using three files, webpage.php, shout.php and shout.txt. Webpage.php can be
changed to whatver you want, it will be the page on which the guestbok is shown, you could even use
this code and add it to another php page n your site. Shout.php is the proccessing page and
shout.txt is where the shouts are stored. Firstly we need to make the visual design of the box....
Making A Dynamic Page On Blogspot
- Using an external server to make your pages hosted on blogspot dynamic (5)
Good morning everyone. Have you ever wondered how to allow your visitors to edit content on your
blog? Like adding a post straight off the page, adding a link, editing your profile etc. This will
be extremely useful if you want your visitors to contribute to your blog besides writing comments or
tagging. 1. Adding a post straight off the page. Go to blogger.com, login, select your blog. Go to
settings -> email. By enabling blog email, you can now add a post by simply sending an email to the
address you specified. The address should look something like: yourusername...
Cpanel Mysql Database Management
- Part 2.1 Of My 7 Part Cpanel Tutorial (6)
This tutorial is an extension to my 7 tutorial series about the Cpanel. The 7 different Cpanel
tutorials can be found below. Part 1: E-mail Management Part 2: Useful Site Management Tools
Part 3: Useful Site Management Tools2.1 Part 4: Analysis/Log Files Part 5: Advanced Tools Part
6: PreInstalled Scripts, Extras, and Cpanel Options Part 7: Fantastico Detailed Cpanel
Tutorial Part 2.1: MySQL Management In this tutorial, i will explain how to add, edit, delete
and over-all manage the MySQL Feature in the Cpanel. Creating a MySQL Database 1) ...
*nix File Permissions - An Overview
- (6)
I was originally going to post this in a reply, but felt it would deviate from the topic.
Here's a brief overview of the three numbers in a permission "code": -The first number is for
the owner of the file. If you set a file at 600, the owner will have read and write access and
everyone else is locked out. -The second number is for the users group (users are placed into groups
to get special rights sometimes). Generally you will not give write access to a user's group.
-The third number is for the rest of the world, including web users. Setting any value that wi...
Checking For Open Ports From Php
- If you want to check the status of a server at a specific port you can (3)
Some days ago, i needed to check ports of a server from a webpage, for advising of its status. I
simply used a great php code that's fsockopen . I'll explain it in the following example:
(Imagine a file called 'checkports.php', containing the next) CODE $address ="
trap17.com"; //Here you can specify the address you want to check ports $port = "80"; //Here you can
specify the port you want to check from $address $checkport = fsockopen($address, $port, $errnum,
$errstr, 2); //The 2 is the time of ping in secs //Here down you can put what to do when...
Looking for starting, stopping, apache, mysql, server, batch, file
|
Searching Video's for starting, stopping, apache, mysql, server, batch, file
See Also,
|
advertisement
|
|