added script to receive commands via ssh

This commit is contained in:
root 2017-02-19 20:06:03 +00:00
parent be494b9c17
commit a1e5039f99
1 changed files with 28 additions and 0 deletions

28
shell.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash --
# shold be started from a separate account
# access via ssh:
# cat .ssh/authorized_keys
# command="/home/automation/chch-power/shell.sh",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAA...
status() {
STATUS="$(cat /tmp/status)"
if [ -z "$STATUS" ]; then
STATUS="geschlossen"
fi
echo "$STATUS"
}
read COMMAND
case "$COMMAND" in
status)
status
;;
*)
echo "ERROR; available commands:" >&2
echo "status" >&2
exit 1
;;
esac
exit 0