Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

SHELL := /usr/bin/env bash
VER := 0.2.12


all:
@export REL=$$(curl -s "https://github.com/joewalnes/websocketd/releases/latest" | cut -d\" -f2 | rev | cut -d/ -f1 | rev | cut -b 2-); \
test -z "$$REL" && export REL=$(VER); \
case "$$(uname -m)" in \
x86_64) \
export ARCH="amd64"; \
;; \
i?86|i.86) \
export ARCH="386"; \
;; \
arm*) \
export ARCH="arm"; \
;; \
aarch64) \
export ARCH="arm64"; \
;; \
*) \
echo "arch is not supported"; \
exit 10; \
;; \
esac; \
case "$$(uname -s)" in \
Darwin) \
export OS="darwin"; \
;; \
Linux) \
export OS="linux"; \
;; \
FreeBSD) \
export OS="freebsd"; \
;; \
OpenBSD) \
export OS="openbsd"; \
;; \
Solaris) \
export OS="solaris"; \
;; \
*) \
echo "os is not supported"; \
exit 11; \
;; \
esac; \
wget -c "https://github.com/joewalnes/websocketd/releases/download/v$${REL}/websocketd-$${REL}-$${OS}_$${ARCH}.zip" && unzip -o "websocketd-$${REL}-$${OS}_$${ARCH}.zip" websocketd; \
rm websocketd-$${REL}-$${OS}_$${ARCH}.zip
9 changes: 6 additions & 3 deletions run
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/sh

# Download websocketd for your platform from
# https://github.com/joewalnes/websocketd/wiki/Download-and-install
echo "$PATH" | tr : \\n | grep -iE "^\.$" || export PATH="$PATH:."

./websocketd --port=9231 --staticdir=web /usr/bin/vmstat -n 1
test -z "$(which websocketd)" && make

websocketd --port=9231 --staticdir=web /usr/bin/vmstat -n 1

exit
2 changes: 1 addition & 1 deletion web/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<title>Stats</title>
<title>stats</title>
<meta charset="utf8">

<link rel="stylesheet" href="stats.css">
Expand Down