LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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, 07: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, 07: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, 09: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 09:45 PM
PHP Shell Script (with MySql) Tony Empire Programming 1 09-20-2005 09:59 AM
Making shell script a part of linux image mayureshchitale Linux - Newbie 1 07-06-2004 01:00 AM
MySQL in a shell script?! zaubara Programming 2 05-31-2004 05:27 PM
MySQL connection in shell script - how to? philipz Programming 3 04-29-2004 07:04 PM


All times are GMT -5. The time now is 01:20 AM.

Main Menu
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