This is a simple web service to remotely power off or reboot a Linux-based machine like Raspberry Pi, Orange Pi, or even x86 PCs. ๐Ÿ–ฅ๏ธ๐ŸŠ๐Ÿ“ Useful for home automation, remote maintenance, or embedded control systems!


๐ŸŽฅ Video Tutorial


Screenshot 1

๐ŸŸข The compiled version can be executed with:

sudo ./SZ_WPowerM

๐Ÿ’ป Python Code

import os
from bottle import route, get, post, run, template

@post('/power')
def power():
    os.system('shutdown -h now')

@post('/restart')
def reboot():
    os.system('reboot')

@route('/')
def index():
    return template('''<!DOCTYPE html>
<html>
<head>
<title>SZ_WPowerR</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>

function power(){
  var link = window.location.href + "power";
  var xhttp = new XMLHttpRequest();
  xhttp.open("POST", link);
  xhttp.send();
}
function restart(){
  var link = window.location.href + "restart";
  var xhttp = new XMLHttpRequest();
  xhttp.open("POST", link);
  xhttp.send();
}
</script>
<style>
a:hover { color: #5c6847; }
a { color: #062b00; text-decoration: none; }
.footer {
  position: fixed;
  bottom: 0;
  right: 15px;
}
.center {
  margin: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.button {
  background-color: #062b00;
  border: none;
  color: white;
  padding: 15px 32px;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
  width: 100%;
}
.button:hover { color: #5c6847; }
body { background-color: #e8d7c2; }
h1 { text-align: center; color: #062b00; }
p { color: #062b00; }
</style>
</head>
<body>
<h1>SZ_WPowerR</h1>
<div class="center">
  <p>Choose action:</p> 
  <button class="button" onclick="restart()">๐Ÿ” Reboot</button>
  <button class="button" onclick="power()">โป Power Off</button>
</div>
<div class="footer">
  <p><a href="https://sznetwork.systems">sznetwork.systems</a></p>
</div>
</body>
</html>
''')

run(host='0.0.0.0', port=8080)

๐Ÿ“ฅ Download

๐Ÿงพ Source code and compiled binary for x86


๐Ÿ›ก๏ธ Notes:

  • Make sure you run the service with root privileges.
  • Works over your local network or can be exposed securely via VPN or reverse proxy.

๐Ÿ”Œ๐Ÿ’ก Easy way to control your devices with just a web browser!