LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-30-2004, 09:35 AM   #1
linuxuser2005
LQ Newbie
 
Registered: May 2004
Posts: 11

Rep: Reputation: 0
Shutdown the System remotely via PHP-Script?


Hello. I want to shutdown my router, which is running Mandrake Linux 10 OE, remotely via my XP Computer by opening a (php) website on the router and press a shutdown button.

Is there any php script available that does exactly this? I haven't found one.

Chris
 
Old 08-30-2004, 11:06 AM   #2
King4lex
Member
 
Registered: Aug 2004
Distribution: Fedora Core 4
Posts: 90

Rep: Reputation: 15
Make a shell script that shuts down the router the way you want it to and execute it in php by using exec(). Example:

Code:
The HTML:

<form action='shutdown.php' method='post'>
<input type='submit' name='submit' value='Shutdown'><br>
</form><br>

THE PHP:

<?php
if(isset($_POST['submit'])) 
//if submit has been pressed
{
 exec("shutrouter");
//NOTE change 'shutrouter' for the name of the script you are executing
}
php?>
Something like that should work. Hope this helps. More information:

www.php.net/exec

Last edited by King4lex; 08-30-2004 at 11:15 AM.
 
Old 08-30-2004, 11:53 AM   #3
linuxuser2005
LQ Newbie
 
Registered: May 2004
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks, I got it now like this, however, I had to allow the user "apache" to run the shutdown command via visudo. Now everything works fine! Incredible :-)
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to remotely shutdown a process darksoul04 Linux - Networking 6 09-11-2005 10:56 PM
Script to shutdown remotely a server dtournas Slackware 3 02-06-2005 02:26 PM
script to shutdown system - howto matthewchin Linux - General 5 07-11-2004 11:11 PM
Shutdown script wont physically turn off my system... cav Slackware 2 09-13-2003 02:06 AM
Batch Script to shutdown the system in the event of power loss scottpioso Linux - Hardware 5 03-12-2003 03:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:44 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
Open Source Consulting | Domain Registration