Missing EOF at '#' in .script

Hi,
i use the exec binding to fire a .script wich sends the temperatur to the screen of a camera.
When Openhab loads there comes an error like this

2019-08-15 11:11:31.958 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘temperatur.script’ has errors, therefore ignoring it: [1,1]: missing EOF at ‘#’

#!/bin/sh
printf "Aussentemperatur: $1 °C" | nc -q 5 192.168.xxx.xx 8000
printf "aktuell Regen: Ja" | nc -q 5 192.168.xxx.xx 8000
printf "Aussentemperatur: $1 °C" | nc -q 5 192.168.xxx.xx 8000
printf "aktuell Regen: Ja" | nc -q 5 192.168.xxx.xx 8000

What is going wrong ?
Regards
Jörg

I’m guessing you put this temperatur.script file in /etc/openhab2/scripts.

It’s confusing but that folder was not created to hold shell scripts like this. It was created to hold Rules DSL Scripts (see the docs). By naming it with .script and putting it in that folder you are telling OH that it’s a file it needs to load and parse like a .rules file, which obviously doesn’t work because it’s not the right format.

You can easily fix it by using the standard naming convention for scripts temperatur.sh. Most properly you would put the shell script in some other folder as that folder was never intended to store shell scripts and sometimes OH will go through and change the permissions on the files in that folder.

thanks for your hints …

Yes you are right :slight_smile:

Can I make a folder like this /etc/openhab2/shellscripts in the openhab root where are all the other folders like items , scripts, rules etc. Or is this critical, when I make a update ?

You can add that folder I think without any problems.

1 Like