diff options
author | Jakob Stendahl <jakobste@uio.no> | 2020-08-27 09:16:27 +0200 |
---|---|---|
committer | Jakob Stendahl <jakobste@uio.no> | 2020-08-27 09:16:27 +0200 |
commit | 67c181b213519205fe0e7bac4646349652835dbb (patch) | |
tree | e6986d8761e0f6fbfce7e92916679c1d284bf61f /bin/lamp | |
parent | 80985a3f817074537bb5d997fc4923294a0c3993 (diff) | |
download | dotfiles-67c181b213519205fe0e7bac4646349652835dbb.tar.gz dotfiles-67c181b213519205fe0e7bac4646349652835dbb.zip |
Update to p10k, and do some small updates
Diffstat (limited to 'bin/lamp')
-rwxr-xr-x | bin/lamp | 15 |
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" |