LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 01-26-2006, 08:34 PM   #1
Lazy Foo'
Member
 
Registered: Dec 2005
Location: LA
Distribution: SuSE 9.3 Pro
Posts: 32

Rep: Reputation: 15
Making a shell script to enable/disable apache/mysql


I have my own website that hosted remotely, but I like to test out my scripts locally before I upload them.

I would like to make a shell script that acts like an on/off switch for apache/mysql.

something like this psuedocode:

if ( apache and mysql are running )
turn them off
else
turn them on

I know there's a way to do it, but I forgot almost everything from my Linux class.

So how would I go about making the script?
 
Old 01-26-2006, 08:46 PM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
Scripts like that already exist on your Linux system in /etc/init.d.
 
Old 01-27-2006, 10:07 AM   #3
TheLinuxDuck
Member
 
Registered: Sep 2002
Location: Tulsa, OK
Distribution: Slack, baby!
Posts: 349

Rep: Reputation: 33
The rc.mysql start/stop script (in /etc/init.d) should have been created when you installed mysql on the server. If it doesn't exist, I can send you mine, but you're going to have to modify the variables in it to point to the location where you installed it.

As for apache, the file should be called rc.httpd.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Odd problem with making a variable the output of a command in a shell script linux=future Programming 3 12-13-2005 10:45 PM
PHP Shell Script (with MySql) Tony Empire Programming 1 09-20-2005 10:59 AM
Making shell script a part of linux image mayureshchitale Linux - Newbie 1 07-06-2004 02:00 AM
MySQL in a shell script?! zaubara Programming 2 05-31-2004 06:27 PM
MySQL connection in shell script - how to? philipz Programming 3 04-29-2004 08:04 PM


All times are GMT -5. The time now is 03:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration