Domoticz Installation on FreeNAS - Autostart Problem...

Status
Not open for further replies.

htavasoglu

Cadet
Joined
Jan 22, 2018
Messages
5
Hi everybody,

I have a FreeNAS server at home and want to install Domoticz in a Jail

I followed the instructions I found on https://www.domoticz.com/wiki/FreeNAS

I created a new jail, downloaded domoticz etc.

Now, if I go to directory in the jail ( ~/domoticz/domoticz ) and input the command ./domoticz than it runs perfectly

What I want to do is to autostart domoticz when I turn on the FreeNAS server

Unfortunately on the instruction page, (https://www.domoticz.com/wiki/FreeNAS) at the last paragraph the link is dead and I am not able to create the file named domoticz inside the rc.d directory

I have no experience in FreeBSD or Linux so please help me accordingly
icon_e_smile.gif


Thanks in advance....
 

toyebox

Explorer
Joined
Aug 20, 2016
Messages
87
Is there a specific reason you aren't using the repository? Using the following command would install everything necessary for you:

pkg install domoticz

To autostart, you would most likely receive a message after running that command saying add domoticz_enable="YES" to your /etc/rc.conf

The prebuilt package contains the rc.d file you are looking for.
 

htavasoglu

Cadet
Joined
Jan 22, 2018
Messages
5
First of all, thank you for your reply.

I tried installation from the repository earlier. It worked well but there was no Plugin support in the repository version, was there?

Do you think the rc.d file is usable for manual installation? Then I will try to install it once more to copy rc.d file.
 

toyebox

Explorer
Joined
Aug 20, 2016
Messages
87
Yes, it can be used but I am not 100% sure if it's a direct plug and play situation. I am not familiar with the directories it calls from and how it compares to the manual installation instructions. It's a simple script and opening it in nano and verifying the directory calls are correct.

As a side note, if you plan on sticking with FreeNAS, or FreeBSD, I would recommend reading about rc.d scripts and try to teach yourself about writing them. They are fairly simple.

Sent from my ONEPLUS A3000 using Tapatalk
 
Last edited by a moderator:

htavasoglu

Cadet
Joined
Jan 22, 2018
Messages
5
At the moment I am trying to edit directory instructions at the repository installed rc.d file to make them suitable for the manual installed one. (domoticz)
I hope I can manage it...

Yes I need to learn about the scripts etc... Soon...
 

captainkent

Dabbler
Joined
Nov 12, 2016
Messages
10
Try this!

Save it under /usr/local/etc/rc.d/domoticz

You might need to adjust the domoticz.db directory and the cmd directory (this is the file you use when you ./domoticz)

Code:
#! /bin/sh
#
#

# PROVIDE: domoticz
# REQUIRE: LOGIN cleanvar
# KEYWORD: shutdown

#
# Add the following lines to /etc/rc.conf to enable domoticz:
#
#domoticz_enable (bool): set to "YES" to start domotics at boot
#domoticz_dbdir (str):   Default to "/var/db/domoticz"
#						domoticz database directory
#domoticz_user (str):	Default to www, user for starting domoticz
#domoticz_group (str):   Default to www, group for stating domoticz
#domoticz_pidfile (str): Custum PID file path and name
#						Default to "/var/run/domoticz/${hostname}.pid".
#domoticz_args (str):	Custom additional arguments to be passed
#

. /etc/rc.subr

name="domoticz"
rcvar="domoticz_enable"
stop_cmd="${name}_stop"

load_rc_config $name

: ${domoticz_dbdir:="/home/domoticz/domoticz"}
: ${domoticz_user:=root}
: ${domoticz_group:=wheel}
: ${domoticz_enable:=NO}
: ${domoticz_directory:=/home/domoticz/domoticz/domoticz}
: ${domoticz_args:="-syslog -daemon"}

#: ${domoticz_args:="-syslog -dbase /home/domoticz/domoticz/db/domoticz.db -daemon -wwwbind 0.0.0.0 -p /var/run/domoticz_1.pid"}

pidfile=${domoticz_pidfile:-"/var/run/domoticz/${hostname}.pid"}

command="/home/domoticz/domoticz/domoticz"
command_args="-dbase ${domoticz_dbdir}/domoticz.db -pidfile ${pidfile} ${domoticz_args}"

domoticz_stop() {
		if [ -e "${pidfile}" ]; then
				echo "Stopping ${name}..."
				kill -9 `cat ${pidfile}`
				rm ${pidfile}
		else

run_rc_command "$1"
 

htavasoglu

Cadet
Joined
Jan 22, 2018
Messages
5
Dear @captainkent thank you for your effort to help me and for editing the file for me.
But unfortunately, perhabs I am so dump that I couldn't manage to autostart domoticz :(

Normally it is running OK with ./domoticz command

root@domoticz:/home/domoticz/domoticz # ./domoticz
2018-01-26 13:58:32.117 Domoticz V3.8849 (c)2012-2018 GizMoCuz
2018-01-26 13:58:32.117 Build Hash: 546758a3, Date: 2018-01-25 11:06:56
2018-01-26 13:58:32.117 Startup Path: /usr/home/domoticz/domoticz/
2018-01-26 13:58:32.157 PluginSystem: Started, Python version '3.5.4'.
2018-01-26 13:58:32.158 Active notification Subsystems: gcm, http (2/14)
2018-01-26 13:58:32.159 WebServer(HTTP) started on address: 0.0.0.0 with port 8080
2018-01-26 13:58:32.161 WebServer(SSL) started on address: 0.0.0.0 with port 443
2018-01-26 13:58:32.161 Proxymanager started.
2018-01-26 13:58:32.161 Starting shared server on: 0.0.0.0:6144
2018-01-26 13:58:32.161 TCPServer: shared server started...
2018-01-26 13:58:32.161 RxQueue: queue worker started...
2018-01-26 13:58:34.166 EventSystem: reset all events...
2018-01-26 13:58:34.166 EventSystem: reset all device statuses...
2018-01-26 13:58:34.178 Python EventSystem: Initalizing event module.
2018-01-26 13:58:34.179 EventSystem: Queue thread started...
2018-01-26 13:58:34.179 EventSystem: Started
2018-01-26 13:58:34.642 PluginSystem: Entering work loop.


My domoticz directory :

root@domoticz:/home/domoticz/domoticz # ls
.git domoticz.sh notifications
.gitattributes dzVents plugins
.github getgit.cmake push
.gitignore hardware README.md
.travis.yml History.txt scripts
appversion.default httpclient server_cert.pem
appversion.h INSTALL.md smtpclient
appversion.h.txt json sqlite
appveyor.yml libusb tcpserver
cmake_install.cmake License.txt tinyxpath
CMakeCache.txt lua tools
CMakeFiles main updatebeta
CMakeLists.txt makebeta updatedomo
Config Makefile updaterelease
CPackConfig.cmake makerelease webserver
CPackSourceConfig.cmake Manual www
domoticz MQTT zip
domoticz.db msbuild zlib



domoticz.db file is here so I edited that part on the file you sent...

My edited version : ( I tried the username as root and domoticz )

#! /bin/sh
#
#

# PROVIDE: domoticz
# REQUIRE: LOGIN cleanvar
# KEYWORD: shutdown

#
# Add the following lines to /etc/rc.conf to enable domoticz:
#
#domoticz_enable (bool): set to "YES" to start domotics at boot
#domoticz_dbdir (str): Default to "/var/db/domoticz"
# domoticz database directory
#domoticz_user (str): Default to www, user for starting domoticz
#domoticz_group (str): Default to www, group for stating domoticz
#domoticz_pidfile (str): Custum PID file path and name
# Default to "/var/run/domoticz/${hostname}.pid".
#domoticz_args (str): Custom additional arguments to be passed
#

. /etc/rc.subr

name="domoticz"
rcvar="domoticz_enable"
stop_cmd="${name}_stop"

load_rc_config $name

: ${domoticz_dbdir:="/home/domoticz/domoticz"}
: ${domoticz_user:=domoticz}
: ${domoticz_group:=domoticz}
: ${domoticz_enable:=NO}
: ${domoticz_directory:=/home/domoticz/domoticz/domoticz}
: ${domoticz_args:="-syslog -daemon"}

#: ${domoticz_args:="-syslog -dbase /home/domoticz/domoticz/domoticz.db -daemon -wwwbind 0.0.0.0 -p /var/run/domoticz_1.pid"}

pidfile=${domoticz_pidfile:-"/var/run/domoticz/${hostname}.pid"}

command="/home/domoticz/domoticz/domoticz"
command_args="-dbase ${domoticz_dbdir}/domoticz.db -pidfile ${pidfile} ${domoticz_args}"

domoticz_stop() {
if [ -e "${pidfile}" ]; then
echo "Stopping ${name}..."
kill -9 `cat ${pidfile}`
rm ${pidfile}
else

run_rc_command "$1"


-----------------------------------------------------------------------

rc.conf file is :

portmap_enable="NO"
sshd_enable="NO"
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
hostname="domoticz"
devfs_enable="YES"
devfs_system_ruleset="devfsrules_common"
domoticz_enable="YES"


--------------------------------------------------------------


What could be the problem?
 

htavasoglu

Cadet
Joined
Jan 22, 2018
Messages
5
@captainkent Yes I've already done that :(

But I realize that if I use service domoticz start command it gives an error message :

root@domoticz:/ # service domoticz start
/etc/rc.d/domoticz: 53: Syntax error: end of file unexpected (expecting "fi")

So there is an error at the last part of the rc.d/domoticz file

I tried to add "}" and "fi" in different combinations but even if it did not give error message it doesn't start the domoticz server either.


Code:
#! /bin/sh
#
#

# PROVIDE: domoticz
# REQUIRE: LOGIN cleanvar
# KEYWORD: shutdown

#
# Add the following lines to /etc/rc.conf to enable domoticz:
#
#domoticz_enable (bool): set to "YES" to start domotics at boot
#domoticz_dbdir (str):   Default to "/var/db/domoticz"
#						domoticz database directory
#domoticz_user (str):	Default to www, user for starting domoticz
#domoticz_group (str):   Default to www, group for stating domoticz
#domoticz_pidfile (str): Custum PID file path and name
#						Default to "/var/run/domoticz/${hostname}.pid".
#domoticz_args (str):	Custom additional arguments to be passed
#

. /etc/rc.subr

name="domoticz"
rcvar="domoticz_enable"
stop_cmd="${name}_stop"

load_rc_config $name

: ${domoticz_dbdir:=/home/domoticz/domoticz}
: ${domoticz_user:=root}
: ${domoticz_group:=wheel}
: ${domoticz_enable:=NO}
: ${domoticz_directory:="/home/domoticz/domoticz/domoticz"}
: ${domoticz_args:="-syslog -daemon"}

#: ${domoticz_args:="-syslog -dbase /home/domoticz/domoticz/domoticz.db -daemon -wwwbind 0.0.0.0 -p /var/run/domoticz_1.pid"}

pidfile=${domoticz_pidfile:-"/var/run/domoticz/${hostname}.pid"}

command="/home/domoticz/domoticz/domoticz"
command_args="-dbase ${domoticz_dbdir}/domoticz.db -pidfile ${pidfile} ${domoticz_args}"

domoticz_stop() {
		if [ -e "${pidfile}" ]; then
				echo "Stopping ${name}..."
				kill -9 `cat ${pidfile}`
				rm ${pidfile}
		else

run_rc_command "$1"
 

Espejot

Cadet
Joined
Feb 4, 2018
Messages
2
Hi,

I have FreeNAS-11.1-U1 running and Domoticz in a warden jail. I have also Aeotec Z-Stick Gen5. I did try to instal stick into a iocage jail but symbolic link to the domoticz jail did not work. I do not know much about linux or FreeNas but i have a friend who helped me. But my friend has no knowledge about Domoticz or configuration scripts of the Domoticz. But anyway, he was able to fix some structural errors of the "/usr/local/etc/rc.d/domoticz" file.

Now autostart is working but Domoticz UI is not responding and there is no content at all. Some links, like 'update' and 'security panel' do work but rest of the menus is not working and there is no content. We had no ideas what is wrong but we are guessing that there is something wrong with Domoticz configuration. Sorry for the bad english.

EDIT: Content is there but are hidden with display none css property
EDIT2: Problem solved installing 'openssl' and UI is working.

disply-none.jpg


/etc/rc.conf
Code:
hostname="domoticz"
devfs_enable="YES"
devfs_system_ruleset="devfsrules_common"
domoticz_enable="YES"



/usr/local/etc/rc.d/domoticz
Code:
. /etc/rc.subr

name="domoticz"
rcvar="domoticz_enable"
stop_cmd="${name}_stop"

load_rc_config $name

: ${domoticz_dbdir:=/home/domoticz/domoticz}
: ${domoticz_user:=root}
: ${domoticz_group:=wheel}
: ${domoticz_enable:=NO}
: ${domoticz_directory:="/home/domoticz/domoticz/"}
: ${domoticz_args:="-syslog -daemon"}

#: ${domoticz_args:="-syslog -dbase /home/domoticz/domoticz/domoticz.db -daemon -wwwbind 0.0.0.0 -p /var/run/domoticz_1.pid"}

pidfile=${domoticz_pidfile:="/var/run/${hostname}.pid"}

command="/home/domoticz/domoticz/domoticz"
command_args="-dbase ${domoticz_dbdir}/domoticz.db -pidfile ${pidfile} ${domoticz_args}"

domoticz_stop() {
		if [ -e "${pidfile}" ]; then
				echo "Stopping ${name}..."
				kill -9 `cat ${pidfile}`
				rm ${pidfile}
		fi
}

run_rc_command "$1"
 
Last edited:
Status
Not open for further replies.
Top