summaryrefslogtreecommitdiff
path: root/config-service-myhostname.PKGBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'config-service-myhostname.PKGBUILD')
-rw-r--r--config-service-myhostname.PKGBUILD32
1 files changed, 30 insertions, 2 deletions
diff --git a/config-service-myhostname.PKGBUILD b/config-service-myhostname.PKGBUILD
index 921b7e7..a5f2cf6 100644
--- a/config-service-myhostname.PKGBUILD
+++ b/config-service-myhostname.PKGBUILD
@@ -1,5 +1,5 @@
. ${BUILDFILE%/*}/common.sh
-pkgver=20161111.1
+pkgver=20161111.2
package() {
preamble
@@ -15,7 +15,10 @@ server {
error_log /var/log/nginx/nginx.http.myhostname.error.log error;
access_log /var/log/nginx/nginx.http.myhostname.access.log specific;
- location = / {
+ root /srv/http/myhostname;
+ autoindex on;
+
+ location = /sysinfo {
uwsgi_pass unix:/run/uwsgi/myhostname.sock;
uwsgi_modifier1 9; # Standard CGI request
include uwsgi_params;
@@ -23,6 +26,31 @@ server {
}
EOF
+add-file -m755 srv/http/myhostname/sysinfo <<EOF
+#!/bin/bash
+# Copyright 2016 Luke Shumaker
+
+cmds=(
+ 'hostnamectl status'
+ "systemctl status | sed '1d;/^\\s*CGroup:/,\\\$d'"
+ 'uptime'
+ 'free -h'
+ "df -Th | sed -n '1p;/^\\/dev/p'"
+)
+
+printf '%s\\r\\n' \\
+ 'Content-Type: text/plain; charset=utf-8' \\
+ ''
+
+for cmd in "\${cmds[@]}"; do
+ printf '\$ %s\\n' "\$cmd"
+ (eval "\$cmd")
+ echo
+done
+EOF
+
+ln -s /var/cache/pacman/pkg srv/http/myhostname/pkg
+
add-file etc/uwsgi/myhostname.ini <<EOF
[uwsgi]
master = true