aboutsummaryrefslogtreecommitdiff
path: root/bin/lamp
diff options
context:
space:
mode:
authorJakob Stendahl <jakobste@uio.no>2020-08-27 09:16:27 +0200
committerJakob Stendahl <jakobste@uio.no>2020-08-27 09:16:27 +0200
commit67c181b213519205fe0e7bac4646349652835dbb (patch)
treee6986d8761e0f6fbfce7e92916679c1d284bf61f /bin/lamp
parent80985a3f817074537bb5d997fc4923294a0c3993 (diff)
downloaddotfiles-67c181b213519205fe0e7bac4646349652835dbb.tar.gz
dotfiles-67c181b213519205fe0e7bac4646349652835dbb.zip
Update to p10k, and do some small updates
Diffstat (limited to 'bin/lamp')
-rwxr-xr-xbin/lamp15
1 files changed, 15 insertions, 0 deletions
diff --git a/bin/lamp b/bin/lamp
new file mode 100755
index 0000000..36cb997
--- /dev/null
+++ b/bin/lamp
@@ -0,0 +1,15 @@
+#!/bin/bash
+ip="192.168.11.201" # Change this,
+URL="http://"$ip"/j?lamp=toggle" # Not this!
+
+HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST $URL)
+HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPSTATUS\:.*//g')
+HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
+
+if [ ! $HTTP_STATUS -eq 200 ]; then
+ echo -e '\033[0;31m'"Error [HTTP status: $HTTP_STATUS]"'\033[0m'
+ exit 1
+fi
+
+#echo -e "\033[0;32m $HTTP_BODY \033[0m"
+echo -e "\033[0;32mLAMP SHOULD NOW BE TOGGELED :)\033[0m"