pedalboard-scripts/toggle-systemd.sh

15 lines
394 B
Bash
Raw Permalink Normal View History

2022-03-25 16:54:28 +01:00
#!/usr/bin/env bash
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT
set -e
dir="$(dirname $(realpath "$0"))"
. "$dir/config.env"
2022-03-30 15:33:31 +02:00
url="$(""$dir"/url.sh" "/systemd" "$1")"
2022-03-25 16:54:28 +01:00
printf "> sending POST request to \'$url\'...${FONT_BOLD}"
2022-03-30 15:33:54 +02:00
[ "$(curl -X POST -s -f -w "\n%{http_code}" "$url" -d "state=toggle" | tail -n1)" -ne 200 ] && printf " error!\n" || printf " done!\n"