aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--%HOME%/.config/systemd/user/linux-status.service10
-rw-r--r--.gitignore1
-rw-r--r--LICENSE.txt21
-rw-r--r--README.md28
-rwxr-xr-xcgi-bin/hostname.sh8
-rwxr-xr-xcgi-bin/systemctl_status_system.sh8
-rwxr-xr-xcgi-bin/systemctl_status_user.sh8
-rwxr-xr-xcgi-bin/systemctl_timers_system.sh8
-rwxr-xr-xcgi-bin/systemctl_timers_user.sh8
-rwxr-xr-xcgi-bin/top.sh8
-rw-r--r--index.html132
11 files changed, 240 insertions, 0 deletions
diff --git a/%HOME%/.config/systemd/user/linux-status.service b/%HOME%/.config/systemd/user/linux-status.service
new file mode 100644
index 0000000..3273327
--- /dev/null
+++ b/%HOME%/.config/systemd/user/linux-status.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=linux-status
+
+[Service]
+Type=simple
+WorkingDirectory=/srv/linux-status
+ExecStart=/usr/bin/python3 -m http.server --cgi
+
+[Install]
+WantedBy=default.target
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..01f2cef
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/links.bin
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..977fc1d
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 Egor Tensin <Egor.Tensin@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..90c1f1f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,28 @@
+linux-status
+============
+
+Simple Linux status web pages.
+
+Deployment
+----------
+
+Clone to /srv/linux-status and use [config-links]:
+
+ > pwd
+ /srv/linux-status
+
+ > ~/workspace/personal/config-links/update.sh
+ ...
+
+ > loginctl enable-linger "$( whoami )"
+ > systemctl --user enable linux-status
+ > systemctl --user start linux-status
+
+[config-links]: https://github.com/egor-tensin/config-links
+
+License
+-------
+Distributed under the MIT License.
+See [LICENSE.txt] for details.
+
+[LICENSE.txt]: LICENSE.txt
diff --git a/cgi-bin/hostname.sh b/cgi-bin/hostname.sh
new file mode 100755
index 0000000..38b7700
--- /dev/null
+++ b/cgi-bin/hostname.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+set -o errexit -o nounset -o pipefail
+
+echo 'Content-Type: plain/text; charset=utf-8'
+echo
+
+hostname
diff --git a/cgi-bin/systemctl_status_system.sh b/cgi-bin/systemctl_status_system.sh
new file mode 100755
index 0000000..119b2e2
--- /dev/null
+++ b/cgi-bin/systemctl_status_system.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+set -o errexit -o nounset -o pipefail
+
+echo 'Content-Type: text/plain; charset=utf-8'
+echo
+
+SYSTEMD_COLORS=no systemctl --system status --no-pager --full
diff --git a/cgi-bin/systemctl_status_user.sh b/cgi-bin/systemctl_status_user.sh
new file mode 100755
index 0000000..7ba1dd3
--- /dev/null
+++ b/cgi-bin/systemctl_status_user.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+set -o errexit -o nounset -o pipefail
+
+echo 'Content-Type: text/plain; charset=utf-8'
+echo
+
+SYSTEMD_COLORS=no systemctl --user status --no-pager --full
diff --git a/cgi-bin/systemctl_timers_system.sh b/cgi-bin/systemctl_timers_system.sh
new file mode 100755
index 0000000..3c93d8b
--- /dev/null
+++ b/cgi-bin/systemctl_timers_system.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+set -o errexit -o nounset -o pipefail
+
+echo 'Content-Type: text/plain; charset=utf-8'
+echo
+
+SYSTEMD_COLORS=no systemctl --system list-timers --all --no-pager --full
diff --git a/cgi-bin/systemctl_timers_user.sh b/cgi-bin/systemctl_timers_user.sh
new file mode 100755
index 0000000..c8b0a95
--- /dev/null
+++ b/cgi-bin/systemctl_timers_user.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+set -o errexit -o nounset -o pipefail
+
+echo 'Content-Type: text/plain; charset=utf-8'
+echo
+
+SYSTEMD_COLORS=no systemctl --user list-timers --all --no-pager --full
diff --git a/cgi-bin/top.sh b/cgi-bin/top.sh
new file mode 100755
index 0000000..630afff
--- /dev/null
+++ b/cgi-bin/top.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+set -o errexit -o nounset -o pipefail
+
+echo 'Content-Type: text/plain; charset=utf-8'
+echo
+
+top -b -n 1
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..4de6bf1
--- /dev/null
+++ b/index.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title></title>
+ <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
+<style>
+.pre-limited {
+ max-height: 400px;
+ overflow-y: scroll;
+}
+</style>
+ </head>
+ <body>
+ <div class="container-fluid">
+ <div class="row">
+ <div class="col-sm">
+ <h1 id="hostname">-</h1>
+ <hr>
+ <p><a href="#collapse_top" data-toggle="collapse"><code>top</code> (refreshed every <span id="top_refresh_interval">-</span> seconds):</a></p>
+ <div class="collapse" id="collapse_top">
+ <pre class="pre-limited" id="top"></pre>
+ </div>
+ <hr>
+ <p><a href="#collapse_systemctl_status_system" data-toggle="collapse"><code>systemctl --system status</code>:</a></p>
+ <div class="collapse" id="collapse_systemctl_status_system">
+ <pre class="pre-limited" id="systemctl_status_system"></pre>
+ </div>
+ <hr>
+ <p><a href="#collapse_systemctl_status_user" data-toggle="collapse"><code>systemctl --user status</code>:</a></p>
+ <div class="collapse" id="collapse_systemctl_status_user">
+ <pre class="pre-limited" id="systemctl_status_user"></pre>
+ </div>
+ <hr>
+ <p><a href="#collapse_systemctl_timers_system" data-toggle="collapse"><code>systemctl --system list-timers --all</code> (refreshed every <span id="systemctl_timers_system_refresh_interval">-</span> seconds):</a></p>
+ <div class="collapse" id="collapse_systemctl_timers_system">
+ <pre class="pre-limited" id="systemctl_timers_system"></pre>
+ </div>
+ <hr>
+ <p><a href="#collapse_systemctl_timers_user" data-toggle="collapse"><code>systemctl --user list-timers --all</code> (refreshed every <span id="systemctl_timers_user_refresh_interval">-</span> seconds):</a></p>
+ <div class="collapse" id="collapse_systemctl_timers_user">
+ <pre class="pre-limited" id="systemctl_timers_user"></pre>
+ </div>
+ <hr>
+ </div>
+ </div>
+ </div>
+ <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
+ <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 refresh_hostname() {
+ $.get('cgi-bin/hostname.sh', function(data) {
+ $('#hostname').text(data);
+ $('title').text(data);
+ });
+}
+
+function refresh_top() {
+ $.get('cgi-bin/top.sh', function(data) {
+ $('#top').text(data);
+ });
+}
+
+function refresh_systemctl_status_system() {
+ $.get('cgi-bin/systemctl_status_system.sh', function(data) {
+ $('#systemctl_status_system').text(data);
+ });
+}
+
+function refresh_systemctl_status_user() {
+ $.get('cgi-bin/systemctl_status_user.sh', function(data) {
+ $('#systemctl_status_user').text(data);
+ });
+}
+
+function refresh_systemctl_timers_system() {
+ $.get('cgi-bin/systemctl_timers_system.sh', function(data) {
+ $('#systemctl_timers_system').text(data);
+ });
+}
+
+function refresh_systemctl_timers_user() {
+ $.get('cgi-bin/systemctl_timers_user.sh', function(data) {
+ $('#systemctl_timers_user').text(data);
+ });
+}
+
+function refresh() {
+ refresh_hostname();
+ refresh_top();
+ refresh_systemctl_status_system();
+ refresh_systemctl_status_user();
+ refresh_systemctl_timers_system();
+ refresh_systemctl_timers_user();
+}
+
+var top_refresh_interval_seconds = 5;
+
+function loop_top() {
+ setInterval(function() { refresh_top(); }, top_refresh_interval_seconds * 1000);
+ $('#top_refresh_interval').text(top_refresh_interval_seconds);
+}
+
+var systemctl_timers_refresh_interval_seconds = 30;
+
+function loop_systemctl_timers() {
+ setInterval(function() {
+ refresh_systemctl_timers_system();
+ refresh_systemctl_timers_user();
+ }, systemctl_timers_refresh_interval_seconds * 1000);
+ $('#systemctl_timers_system_refresh_interval').text(systemctl_timers_refresh_interval_seconds);
+ $('#systemctl_timers_user_refresh_interval').text(systemctl_timers_refresh_interval_seconds);
+}
+
+function loop() {
+ loop_top();
+ loop_systemctl_timers();
+}
+
+function main() {
+ refresh();
+ loop();
+}
+
+$(function() {
+ main();
+});
+ </script>
+ </body>
+</html>