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
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...
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.