summaryrefslogtreecommitdiff
path: root/config-service-myhostname.PKGBUILD
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-11-11 08:17:00 +0000
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-11-11 08:17:00 +0000
commite64ef24ed35f28fb2985584f0ca07b51faf0ef64 (patch)
tree6415132329e77b9af641d531b33efda6603b38c7 /config-service-myhostname.PKGBUILD
parente6ab8cf5eb8cc9448af085b2bfc813aec614c22c (diff)
fixity
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