aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/index.html
blob: 16c5ef991eb92bb086d9bedca537a85cd35bfb0d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!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="css/bootstrap.min.css">
    <style>
.button-expand {
    margin-right: 1em;
}
h1, .h1 {
    margin-top: 20px;
}
    </style>
  </head>
  <body>
    <div class="container">
      <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 show" id="collapse_top">
            <pre class="pre-scrollable" id="top"></pre>
          </div>
          <hr>
          <p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_systemctl_failed_system">+</button><a href="#collapse_systemctl_failed_system" data-toggle="collapse"><code>systemctl --system list-units --failed</code></a></p>
          <div class="collapse show" id="collapse_systemctl_failed_system">
            <pre class="pre-scrollable" id="systemctl_failed_system"></pre>
          </div>
          <hr>
          <p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_systemctl_failed_user">+</button><a href="#collapse_systemctl_failed_user" data-toggle="collapse"><code>systemctl --user list-units --failed</code></a></p>
          <div class="collapse show" id="collapse_systemctl_failed_user">
            <pre class="pre-scrollable" id="systemctl_failed_user"></pre>
          </div>
          <hr>
          <p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_systemctl_status_system">+</button><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-scrollable" id="systemctl_status_system"></pre>
          </div>
          <hr>
          <p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_systemctl_status_user">+</button><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-scrollable" id="systemctl_status_user"></pre>
          </div>
          <hr>
          <p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_systemctl_timers_system">+</button><a href="#collapse_systemctl_timers_system" data-toggle="collapse"><code>systemctl --system list-timers --all</code></a> <span class="float-right"><small>updated every <span id="systemctl_timers_system_refresh_interval">-</span> seconds</small></span></p>
          <div class="collapse" id="collapse_systemctl_timers_system">
            <pre class="pre-scrollable" id="systemctl_timers_system"></pre>
          </div>
          <hr>
          <p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_systemctl_timers_user">+</button><a href="#collapse_systemctl_timers_user" data-toggle="collapse"><code>systemctl --user list-timers --all</code></a> <span class="float-right"><small>updated every <span id="systemctl_timers_user_refresh_interval">-</span> seconds</small></span></p>
          <div class="collapse" id="collapse_systemctl_timers_user">
            <pre class="pre-scrollable" id="systemctl_timers_user"></pre>
          </div>
          <hr>
        </div>
      </div>
    </div>
    <script src="js/jquery-3.3.1.min.js"></script>
    <script src="js/bootstrap.bundle.min.js"></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);
        $('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_failed_system() {
    $.get('cgi-bin/systemctl_failed_system.sh', function(data) {
        $('#systemctl_failed_system').text(data);
    });
}

function refresh_systemctl_failed_user() {
    $.get('cgi-bin/systemctl_failed_user.sh', function(data) {
        $('#systemctl_failed_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_failed_system();
    refresh_systemctl_failed_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>