0

i want to monitor, stop and stop a service. but cant get a clue hot to do that.

the monitor is ok by using this code:
<pre><p></p>
<span class="style1"><b>Service asterisk:</b> </span>
<?php system("/var/www/html/cam/mysql.sh"); ?></br>

</pre>

and in the file services.sh
service mysql status

i have also use:
<?php
$mysql = shell_exec('service mysqld stop');
echo "<pre>$mysql</pre>";
?>

but i am getting the error below:
================================
Stopping MySQL: [FAILED]
=======================================


but how to include a start and stop button and make it work.


thanks in advance

Edited by shaqib: n/a

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by rch1231
0

Hello,

Well you are running into a couple of things that you really need to think about. The security in the server is such that users from the internet should not be able to start and stop services on the server. If you can start and stop it anybody can. You would have to do it from mysqladmin and you would need the root mysql password.

If you don't mind me asking why do you need to stop and start the service from a web page?

0

that's because sometimes MySQL services freezes.i need to stop and start it again.
am trying to write a php system to do that, so that my client can do it by themselves. no need for me to intervene.

0

Hello,

OK your call. It is unusual for mysql to just freeze. Have you looked at the logs to see what is causing it. I run multiple web servers that have not had mysql restarted in over a year.
In any event you need to do a system call and run

mysqladmin stop -u root -p

and have them enter the mysql root password when prompted.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.