[Debian Server] Shutdown/Reboot through web interface

Need help with C, C++, perl, python, etc?

[Debian Server] Shutdown/Reboot through web interface

Postby syncom » 2016-11-13 20:17

Can I shutdown or reboot my Debian server through a web interface? I'm looking for an application or preconfigured script.
syncom
 
Posts: 3
Joined: 2016-11-05 19:29

Re: [Debian Server] Shutdown/Reboot through web interface

Postby GarryRicketson » 2016-11-13 21:15

Via ssh you can
See :
Code: Select all
man shutdown

Pay particular attention to the -r option:
OPTIONS
-a Use /etc/shutdown.allow.

-k Don't really shutdown; only send the warning messages to every‐
body.

-r Reboot after shutdown.


I do not know why you would need a special application, or
pre configured script :
I'm looking for an application or preconfigured script.

It is a simple command:
Code: Select all
shutdown -r now

or use the other options as discussed in the manual.
With out any other details about the server, it is hard to say, and I am not responsible,
becuase I have know way of knowing how the server is set up, if it is "hosted" or
the providers have restrictions etc.
Some providers/hosting do have a "control panel" of some sort, that makes it
just a matter of clicking a button, you might be better off asking the provider or hosting
about this, to make sure there is someone that can re-boot it , if you have trouble, and
they could give you the details as to what the proceedure is.

If all you need to do is re-start the webserver. that would depend on what webserver
you have, for example, if it is apache2 on Debian 8 and up :
Code: Select all
systemctl restart apache2

see
Code: Select all
man apache2

if it is "nginx", it is different, see the manual for nginx,...
"What we expect you have already Done"

Before doing anything, read the Debian documentation:
Debian Documentation
How to ask the smart way
Debian Foro Español
======================
For the Birds
User avatar
GarryRicketson
 
Posts: 4353
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: [Debian Server] Shutdown/Reboot through web interface

Postby kedaha » 2016-11-13 21:58

I'm puzzled why you'd want to do that rather than just reboot through your terminal via ssh.
Mate DE & OSSv4.
LaMp, WordPress; ispmail
Debian Stable & Software

Words, as is well known, are the great foes of reality. Joseph Conrad.
User avatar
kedaha
 
Posts: 2797
Joined: 2008-05-24 12:26

Re: [Debian Server] Shutdown/Reboot through web interface

Postby dasein » 2016-11-14 00:07

syncom wrote:Can I shutdown or reboot my Debian server through a web interface?

You could...

But why on Earth would you want to??

At best this idea means adding a new security point-of-failure in exchange for zero functionality.

If it sounds nonsensical to ask it in those terms ("Is it possible to add a new security point-of-failure in exchange for zero functionality?"), then that's a big clue why folks are wondering why you'd want to such a thing.
User avatar
dasein
 
Posts: 7775
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: [Debian Server] Shutdown/Reboot through web interface

Postby syncom » 2016-11-14 05:32

Thanks everyone for reply. The machine is only an home-made mini server.
I followed this guide https://www.howtoforge.com/tutorial/perfect-server-debian-8-4-jessie-apache-bind-dovecot-ispconfig-3-1/

I have installed Nut and now I can monitor 3 UPS in master/slave configuration, so it's principally for internal but educational purpose also. SSH for shutdown or reboot works very well but I prefer a web interface with two button. Webmin could be a solution but already I have ISPConfig and I don't want trouble...
syncom
 
Posts: 3
Joined: 2016-11-05 19:29

Re: [Debian Server] Shutdown/Reboot through web interface

Postby kedaha » 2016-11-14 10:33

syncom wrote:The machine is only an home-made mini server.
I followed this guide https://www.howtoforge.com/tutorial/perfect-server-debian-8-4-jessie-apache-bind-dovecot-ispconfig-3-1/

I have installed Nut and now I can monitor 3 UPS in master/slave configuration, so it's principally for internal but educational purpose also. SSH for shutdown or reboot works very well but I prefer a web interface with two button. Webmin could be a solution but already I have ISPConfig and I don't want trouble...

Best advice to avoid trouble is not to install third-party Hosting Control Panels like ISPConfig and Webmin, which are not available — for good reasons— from official Debian repositories, but to learn to administer the server, in general, via the command line interface.
Mate DE & OSSv4.
LaMp, WordPress; ispmail
Debian Stable & Software

Words, as is well known, are the great foes of reality. Joseph Conrad.
User avatar
kedaha
 
Posts: 2797
Joined: 2008-05-24 12:26

Re: [Debian Server] Shutdown/Reboot through web interface

Postby pylkko » 2016-11-14 20:02

Well, how about a minimal server in python and os module to signal to systemctl?

Or node-reboot which does not even need to call shutdown
https://github.com/egorfine/node-reboot

basically just take the simple example from node web site to create small web server. But insttad of hello world use node-reboot and two buttons:

Code: Select all
const http = require('http');

const hostname = '127.0.0.1';
const port = 3000;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello World\n');
});

server.listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);
});
User avatar
pylkko
 
Posts: 1174
Joined: 2014-11-06 19:02


Return to Programming

Who is online

Users browsing this forum: No registered users and 3 guests

fashionable