Page 1 of 3

Synology - script doesn't work

Posted: Wednesday 05 January 2022 9:26
by fabry91
Hello,

I have a Synology NAS with Domoticz running as a docker, I previuosly have Domoticz running on a raspberry and the script for a SR-201 relay was working perfect.

Now that I migrate to Synology nas I'm having some problem to run the script, it self it is:

echo -n "11" | nc -n -w 1 192.168.0.99 6722
echo -n "21" | nc -n -w 1 192.168.0.99 6722

The first is for the on action and the second for the off action, the .sh script is present in my nas, maybe I write the wrong path? :roll:
The log file say:

Code: Select all

Error: SQLHelper: Error script not found '/volume1/docker/Domoticz/scripts/relay_ch1_on.sh'
Thank you in advanced

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 9:58
by EddyG
From within the folders of the Synology NAS are not reachable with the normal Synology path
It depends on how you installed the Domoticz container in Docker.
So tell us the install.

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 11:02
by fabry91
EddyG wrote: Wednesday 05 January 2022 9:58 From within the folders of the Synology NAS are not reachable with the normal Synology path
It depends on how you installed the Domoticz container in Docker.
So tell us the install.
Hello Eddy,

thank you for your reply!

i have followed this docker guide: https://registry.hub.docker.com/r/domoticz/domoticz

I don't know which one of these two path is the installation path container of Domoticz:

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 11:28
by EddyG
fabry91 wrote: Wednesday 05 January 2022 11:02 i have followed this docker guide: https://registry.hub.docker.com/r/domoticz/domoticz
Did you follow the docker run method or the docker-compose methode
and what is the part that you used in

Code: Select all

-v <path for config files>:/opt/domoticz/userdata \
or

Code: Select all

    volumes:
      - ./config:/opt/domoticz/userdata
And if you used the compose methode, what path on your Synology is that docker-compose.yaml file

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 11:47
by fabry91
EddyG wrote: Wednesday 05 January 2022 11:28
fabry91 wrote: Wednesday 05 January 2022 11:02 i have followed this docker guide: https://registry.hub.docker.com/r/domoticz/domoticz
Did you follow the docker run method or the docker-compose methode
and what is the part that you used in

Code: Select all

-v <path for config files>:/opt/domoticz/userdata \
or

Code: Select all

    volumes:
      - ./config:/opt/domoticz/userdata
And if you used the compose methode, what path on your Synology is that docker-compose.yaml file
I don't remember which method I followed :( where can I find the docker-compose.yaml file? Is in the docker folder of volume1?

Anyway I checked the container log of the first day when I installed Domoticz with docker, it seems to be opt/domoticz/...

But if I check the /volume1/opt/ I only find "containerd" without any domoticz folder

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 12:15
by EddyG
Do you know where your domoticz.db file is placed? normally the scripts and plugin dirs are below that one.
Could be /Volume1/docker/Domoticz

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 12:26
by fabry91
EddyG wrote: Wednesday 05 January 2022 12:15 Do you know where your domoticz.db file is placed? normally the scripts and plugin dirs are below that one.
Could be /Volume1/docker/Domoticz
Yes it is placed in the docker/Domoticz folder, and also the scripts are presents in the scripts folder:

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 12:44
by EddyG
Your script location from within docker is not

Code: Select all

/volume1/docker/Domoticz/scripts/relay_ch1_on.sh
but probably

Code: Select all

/opt/domoticz/userdata/scripts/relay_ch1_on.sh
you could check that with

Code: Select all

docker run -it domoticz/domoticz /bin/bash
ls -al /opt/domoticz/userdata/scripts/ 
exit docker with just exit.

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 12:49
by fabry91
EddyG wrote: Wednesday 05 January 2022 12:44 Your script location from within docker is not

Code: Select all

/volume1/docker/Domoticz/scripts/relay_ch1_on.sh
but probably

Code: Select all

/opt/domoticz/userdata/scripts/relay_ch1_on.sh
you could check that with

Code: Select all

docker run -it domoticz/domoticz /bin/bash
ls -al /opt/domoticz/userdata/scripts/ 
exit docker with just exit.
It can't find the path if I search:

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 12:55
by EddyG
Then you have a problem with the Domoticz docker installation.
The scripts and plugins directories are not brought outside of docker and cannot be accessed.
Now it depends on the method how you installed Domoticz in docker.

Just to give an idea. My test system (raspberry) runs with this compose file.

Code: Select all

version: '2.1'

services:
  domoticz:
    image: domoticz/domoticz:latest
    container_name: domoticz
    restart: unless-stopped
    # Pass devices to container
    devices:
       - "/dev/serial/by-id/usb-0658_0200-if00:/dev/ttyACM0"
    ports:
      - "8080:8080"
    volumes:
      - /var/lib/docker/volumes/domoticz:/opt/domoticz/userdata
      - /var/lib/docker/volumes/domoticz/www/templates:/opt/domoticz/www/templates
      - /var/lib/docker/volumes/domoticz/scripts:/opt/domoticz/scripts
    environment:
      - TZ=Europe/Amsterdam
      - LOG_PATH=/opt/domoticz/userdata/domoticz.log
It gets the www/templates and scripts directories outside of docker.

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 12:59
by fabry91
EddyG wrote: Wednesday 05 January 2022 12:55 Then you have a problem with the Domoticz docker installation.
The scripts and plugins directories are not brought outside of docker and cannot be accessed.
Now it depends on the method how you installed Domoticz in docker.
Okay, but why the plugin that I have placed in "volume1/docker/domoticz/plugin" are working and I can see in the hardware tab? :|

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 13:04
by EddyG
I have no idea, because I don't know you setup. "domoticz" is an other dir then "Domoticz", or did you mistype the "D"?

BUT did you check if the suggested script path worked?

Code: Select all

/opt/domoticz/userdata/scripts/relay_ch1_on.sh
Or

Code: Select all

/opt/domoticz/scripts/relay_ch1_on.sh

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 13:10
by fabry91
EddyG wrote: Wednesday 05 January 2022 13:04 I have no idea, because I don't know you setup. "domoticz" is an other dir then "Domoticz", or did you mistype the "D"?
I mistype the "D", the setup it seems correct because also the container volume path is "/opt/domoticz/userdate/", maybe I need to copy the scripts file in "/volume1/docker/domoticz/scripts" to "/opt/domoticz/scripts" folder?

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 13:11
by waltervl
What is in /opt/domoticz (ls /opt/domoticz) from within the docker container? Is there a scripts folder? And what is in scripts?

Then use could use /opt/domoticz/scripts/relay_ch1_on.sh as action

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 13:15
by fabry91
waltervl wrote: Wednesday 05 January 2022 13:11 What is in /opt/domoticz (ls /opt/domoticz) from within the docker container? Is there a scripts folder? And what is in scripts?

Then use could use /opt/domoticz/scripts/relay_ch1_on.sh as action
Here what there is inside "/opt/domoticz/scripts/":

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 15:10
by EddyG
fabry91 wrote: Wednesday 05 January 2022 13:10
EddyG wrote: Wednesday 05 January 2022 13:04 I have no idea, because I don't know you setup. "domoticz" is an other dir then "Domoticz", or did you mistype the "D"?
I mistype the "D", the setup it seems correct because also the container volume path is "/opt/domoticz/userdate/", maybe I need to copy the scripts file in "/volume1/docker/domoticz/scripts" to "/opt/domoticz/scripts" folder?
So add /volume1/docker/Domoticz/scripts with /opt/domoticz/scripts to the path in the docker GUI on the Synology.
Keep in mind that you have to change the action path in Domoticz too.

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 15:19
by fabry91
EddyG wrote: Wednesday 05 January 2022 15:10
fabry91 wrote: Wednesday 05 January 2022 13:10
EddyG wrote: Wednesday 05 January 2022 13:04 I have no idea, because I don't know you setup. "domoticz" is an other dir then "Domoticz", or did you mistype the "D"?
I mistype the "D", the setup it seems correct because also the container volume path is "/opt/domoticz/userdate/", maybe I need to copy the scripts file in "/volume1/docker/domoticz/scripts" to "/opt/domoticz/scripts" folder?
So add /volume1/docker/Domoticz/scripts with /opt/domoticz/scripts to the path in the docker GUI on the Synology.
Keep in mind that you have to change the action path in Domoticz too.
Added folder "docker/domoticz/scripts" with mount path "opt/domoticz/scripts" but same result:

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 15:24
by EddyG
same typo "domoticz" -> "Domoticz" in scripts action path in Domoticz
AND you should change the path.

Remember: Inside docker path start with /opt/domoticz
Outside docker path start with /volume1/docker/Domoticz

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 15:40
by fabry91
EddyG wrote: Wednesday 05 January 2022 15:24 same typo "domoticz" -> "Domoticz" in scripts action path in Domoticz
AND you should change the path.

Remember: Inside docker path start with /opt/domoticz
Outside docker path start with /volume1/docker/Domoticz
Yes, check, everything is right?

Re: Synology - script doesn't work

Posted: Wednesday 05 January 2022 15:45
by EddyG
It should be:

Code: Select all

script:///opt/domoticz/scripts/relay....
because Domoticz is inside docker and using paths like /opt/domoticz/.....

You could check what the right path is by going inside docker.