Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Debian Server] Shutdown/Reboot through web interface

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
syncom
Posts: 6
Joined: 2016-11-05 19:29

[Debian Server] Shutdown/Reboot through web interface

#1 Post by syncom »

Can I shutdown or reboot my Debian server through a web interface? I'm looking for an application or preconfigured script.

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

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

#2 Post by GarryRicketson »

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

kedaha
Posts: 3521
Joined: 2008-05-24 12:26
Has thanked: 33 times
Been thanked: 77 times

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

#3 Post by kedaha »

I'm puzzled why you'd want to do that rather than just reboot through your terminal via ssh.
DebianStable

Code: Select all

$ vrms

No non-free or contrib packages installed on debian!  rms would be proud.

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

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

#4 Post by dasein »

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.

syncom
Posts: 6
Joined: 2016-11-05 19:29

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

#5 Post by syncom »

Thanks everyone for reply. The machine is only an home-made mini server.
I followed this guide https://www.howtoforge.com/tutorial/per ... onfig-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...

kedaha
Posts: 3521
Joined: 2008-05-24 12:26
Has thanked: 33 times
Been thanked: 77 times

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

#6 Post by kedaha »

syncom wrote:The machine is only an home-made mini server.
I followed this guide https://www.howtoforge.com/tutorial/per ... onfig-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.
DebianStable

Code: Select all

$ vrms

No non-free or contrib packages installed on debian!  rms would be proud.

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

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

#7 Post by pylkko »

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}/`);
});

Post Reply