diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2018-07-05 04:43:10 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2018-07-05 04:43:10 +0300 |
commit | 3792e9cf4b63d57050c883b3d5164ff5e34ccf0a (patch) | |
tree | 654662053656fecd7d49be673d39259e47e63955 | |
parent | code style (diff) | |
download | linux-status-3792e9cf4b63d57050c883b3d5164ff5e34ccf0a.tar.gz linux-status-3792e9cf4b63d57050c883b3d5164ff5e34ccf0a.zip |
add reboot/shutdown buttons
Diffstat (limited to '')
-rwxr-xr-x | cgi-bin/poweroff.sh | 5 | ||||
-rwxr-xr-x | cgi-bin/reboot.sh | 5 | ||||
-rw-r--r-- | index.html | 20 |
3 files changed, 29 insertions, 1 deletions
diff --git a/cgi-bin/poweroff.sh b/cgi-bin/poweroff.sh new file mode 100755 index 0000000..d0df856 --- /dev/null +++ b/cgi-bin/poweroff.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -o errexit -o nounset -o pipefail + +systemctl poweroff diff --git a/cgi-bin/reboot.sh b/cgi-bin/reboot.sh new file mode 100755 index 0000000..b8bb350 --- /dev/null +++ b/cgi-bin/reboot.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -o errexit -o nounset -o pipefail + +systemctl reboot @@ -13,7 +13,7 @@ .button-expand { margin-right: 1em; } -h1 { +h1, .h1 { margin-top: 20px; } </style> @@ -23,6 +23,16 @@ h1 { <div class="row"> <div class="col"> <h1 id="hostname">-</h1> + </div> + <div class="col h1 text-right"> + <div class="btn-group align-middle" role="group"> + <a role="button" class="btn btn-sm btn-warning" href="#" onclick="reboot();">Reboot</a> + <a role="button" class="btn btn-sm btn-danger" href="#" onclick="shutdown();">Shutdown</a> + </div> + </div> + </div> + <div class="row"> + <div class="col"> <hr> <p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_top">+</button><a href="#collapse_top" data-toggle="collapse"><code>top</code></a> <span class="float-right"><small>updated every <span id="top_refresh_interval">-</span> seconds</small></span></p> <div class="collapse" id="collapse_top"> @@ -56,6 +66,14 @@ h1 { <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script> <script> +function reboot() { + $.get('cgi-bin/reboot.sh'); +} + +function shutdown() { + $.get('cgi-bin/poweroff.sh'); +} + function refresh_hostname() { $.get('cgi-bin/hostname.sh', function(data) { $('#hostname').text(data); |