From 98219880fdd74af11df4a0d410b7af17b1d1d8fe Mon Sep 17 00:00:00 2001 From: Adriel Sand Date: Wed, 22 Sep 2021 21:20:08 +0300 Subject: [PATCH] added the cgi script --- make-new-file.cgi | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 make-new-file.cgi diff --git a/make-new-file.cgi b/make-new-file.cgi new file mode 100755 index 0000000..75c4cf0 --- /dev/null +++ b/make-new-file.cgi @@ -0,0 +1,19 @@ +#!/bin/bash + +echo "Content-type: text/html" +echo "" + +if [[ $(cat state.txt) = "ON" ]] +then + echo "OFF" > state.txt + echo $(cat off.html) > /usr/local/apache2/htdocs/index.html + ./telegram "✅ The generator is OFF!" +else + echo "ON" > state.txt + echo $(cat on.html) > /usr/local/apache2/htdocs/index.html + ./telegram "❌ The generator is on. :(" +fi + +echo 'DONE' + +exit 0