LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Making a shell script to enable/disable apache/mysql (https://www.linuxquestions.org/questions/programming-9/making-a-shell-script-to-enable-disable-apache-mysql-408400/)

Lazy Foo' 01-26-2006 07:34 PM

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?

Hko 01-26-2006 07:46 PM

Scripts like that already exist on your Linux system in /etc/init.d.

TheLinuxDuck 01-27-2006 09:07 AM

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.


All times are GMT -5. The time now is 10:50 PM.