Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 5th August 2009, 08:48
stemy stemy is offline
Junior Member
 
Join Date: Aug 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Web page to restart and shutdown server

I have a recently set up a Ubuntu server 9.04 and would like to have one small web page with two buttons on: Restart and shutdown.

Is this something that already exists or easy can bee made?


Linux newbie
Reply With Quote
Sponsored Links
  #2  
Old 6th August 2009, 14:30
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,711
Thanks: 1,899
Thanked 2,702 Times in 2,545 Posts
Default

You'd have to modify /etc/sudoers so that the Apache user (www-data) can run commands with root privileges. But keep in mind that this is a big security risk if you share this server with others...
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 16th August 2009, 06:45
Evgeni Evgeni is offline
Junior Member
 
Join Date: Aug 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

Quote:
Originally Posted by stemy View Post
I have a recently set up a Ubuntu server 9.04 and would like to have one small web page with two buttons on: Restart and shutdown.

Is this something that already exists or easy can bee made?


Linux newbie
This could be easily set up.
1. Make a PHP form with the HTML's `action' attribute set to its own address and method="post".
2. In the PHP on this page, check if the invocation was a result of the form being submitted (check the POST variables).
3. If so, run a system command (using exec(..)) from PHP to restart/shutdown. There are several options for this, try /sbin/reboot or crontab (in the terminal type "man crontab" or "man reboot" to see the manuals for these). You will need enough privileges, as was said earlier.

Make sure that you use some sort of authentication and restrict access to the page to SSL/TLS only, etc. otherwise various kids will be restarting your server all day long.
__________________
Sketchlife - Second Life building tool on SketchUp
http://vrshed.com/sketchlife
Reply With Quote
Reply

Bookmarks

Tags
admin, webmin

Thread Tools
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
"mo" respawning too fast: disabled for 5 minutes alexo HOWTO-Related Questions 14 8th March 2009 15:46
Apache / httpd restart / startup failed without errors Aldert Server Operation 11 30th January 2008 17:11
Problem with keeping Apache alive bobeq Server Operation 3 29th November 2007 16:11
proftpd shutdown but no restart jmroth Installation/Configuration 3 26th October 2006 12:15


All times are GMT +2. The time now is 10:45.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.