From 33298d0fadbb162dfacf653e3e04fa92226544d0 Mon Sep 17 00:00:00 2001 From: jbnadal Date: Thu, 8 Jun 2017 12:19:27 +0200 Subject: [PATCH] Add start script to launch domod and sprinklerd --- bsp/board/domo/ovl/etc/init.d/domod | 24 +++++++++++++++++++ bsp/board/domo/ovl/etc/init.d/sprinklerd | 24 +++++++++++++++++++ bsp/board/domo/ovl/etc/rc.d/K60domod | 1 + bsp/board/domo/ovl/etc/rc.d/K62sprinklerd | 1 + bsp/board/domo/ovl/etc/rc.d/S60domod | 1 + bsp/board/domo/ovl/etc/rc.d/S62sprinklerd | 1 + .../usr/local/share/{ => domo}/Devices.json | 0 .../usr/local/share/{ => domo}/Timers.json | 0 .../local/share/{ => domo}/capabilities.json | 0 src/prog/domod/src/main.cpp | 14 +++-------- 10 files changed, 55 insertions(+), 11 deletions(-) create mode 100755 bsp/board/domo/ovl/etc/init.d/domod create mode 100755 bsp/board/domo/ovl/etc/init.d/sprinklerd create mode 120000 bsp/board/domo/ovl/etc/rc.d/K60domod create mode 120000 bsp/board/domo/ovl/etc/rc.d/K62sprinklerd create mode 120000 bsp/board/domo/ovl/etc/rc.d/S60domod create mode 120000 bsp/board/domo/ovl/etc/rc.d/S62sprinklerd rename bsp/board/domo/ovl/usr/local/share/{ => domo}/Devices.json (100%) rename bsp/board/domo/ovl/usr/local/share/{ => domo}/Timers.json (100%) rename bsp/board/domo/ovl/usr/local/share/{ => domo}/capabilities.json (100%) diff --git a/bsp/board/domo/ovl/etc/init.d/domod b/bsp/board/domo/ovl/etc/init.d/domod new file mode 100755 index 00000000..8bfb2db3 --- /dev/null +++ b/bsp/board/domo/ovl/etc/init.d/domod @@ -0,0 +1,24 @@ +#!/bin/sh /etc/rc.common +# +# Start Domo Daemon + +START=60 +STOP=60 + +NAME=domod + +PROG=/usr/local/bin/$NAME +PIDFILE=/var/run/$NAME.pid + +USE_PROCD=1 + +# PROCD_DEBUG=1 + +start_service () { + + procd_open_instance + procd_set_param command "$PROG" + procd_set_param pidfile "$PIDFILE" + procd_set_param respawn + procd_close_instance +} diff --git a/bsp/board/domo/ovl/etc/init.d/sprinklerd b/bsp/board/domo/ovl/etc/init.d/sprinklerd new file mode 100755 index 00000000..4deacf0d --- /dev/null +++ b/bsp/board/domo/ovl/etc/init.d/sprinklerd @@ -0,0 +1,24 @@ +#!/bin/sh /etc/rc.common +# +# Start Sprinkler Daemon + +START=62 +STOP=62 + +NAME=sprinklerd + +PROG=/usr/local/bin/$NAME +PIDFILE=/var/run/$NAME.pid + +USE_PROCD=1 + +# PROCD_DEBUG=1 + +start_service () { + + procd_open_instance + procd_set_param command "$PROG" + procd_set_param pidfile "$PIDFILE" + procd_set_param respawn + procd_close_instance +} diff --git a/bsp/board/domo/ovl/etc/rc.d/K60domod b/bsp/board/domo/ovl/etc/rc.d/K60domod new file mode 120000 index 00000000..7bfaa1c7 --- /dev/null +++ b/bsp/board/domo/ovl/etc/rc.d/K60domod @@ -0,0 +1 @@ +../init.d/domod \ No newline at end of file diff --git a/bsp/board/domo/ovl/etc/rc.d/K62sprinklerd b/bsp/board/domo/ovl/etc/rc.d/K62sprinklerd new file mode 120000 index 00000000..806da33a --- /dev/null +++ b/bsp/board/domo/ovl/etc/rc.d/K62sprinklerd @@ -0,0 +1 @@ +../init.d/sprinklerd \ No newline at end of file diff --git a/bsp/board/domo/ovl/etc/rc.d/S60domod b/bsp/board/domo/ovl/etc/rc.d/S60domod new file mode 120000 index 00000000..7bfaa1c7 --- /dev/null +++ b/bsp/board/domo/ovl/etc/rc.d/S60domod @@ -0,0 +1 @@ +../init.d/domod \ No newline at end of file diff --git a/bsp/board/domo/ovl/etc/rc.d/S62sprinklerd b/bsp/board/domo/ovl/etc/rc.d/S62sprinklerd new file mode 120000 index 00000000..806da33a --- /dev/null +++ b/bsp/board/domo/ovl/etc/rc.d/S62sprinklerd @@ -0,0 +1 @@ +../init.d/sprinklerd \ No newline at end of file diff --git a/bsp/board/domo/ovl/usr/local/share/Devices.json b/bsp/board/domo/ovl/usr/local/share/domo/Devices.json similarity index 100% rename from bsp/board/domo/ovl/usr/local/share/Devices.json rename to bsp/board/domo/ovl/usr/local/share/domo/Devices.json diff --git a/bsp/board/domo/ovl/usr/local/share/Timers.json b/bsp/board/domo/ovl/usr/local/share/domo/Timers.json similarity index 100% rename from bsp/board/domo/ovl/usr/local/share/Timers.json rename to bsp/board/domo/ovl/usr/local/share/domo/Timers.json diff --git a/bsp/board/domo/ovl/usr/local/share/capabilities.json b/bsp/board/domo/ovl/usr/local/share/domo/capabilities.json similarity index 100% rename from bsp/board/domo/ovl/usr/local/share/capabilities.json rename to bsp/board/domo/ovl/usr/local/share/domo/capabilities.json diff --git a/src/prog/domod/src/main.cpp b/src/prog/domod/src/main.cpp index c5427f45..ba264f6e 100644 --- a/src/prog/domod/src/main.cpp +++ b/src/prog/domod/src/main.cpp @@ -44,7 +44,7 @@ extern "C" { /*--------------------------------- GLOBALS ---------------------------------*/ - +#define kConfigPath "/usr/local/share/domo/" /*! ---------------------------------------------------------------------------- * @fn setupUbus @@ -87,23 +87,15 @@ static struct ubus_context *setupUbus (void) int main (void) { int theRet = 0; - char *theWritePath; std::string theDevicePath, theTimerPath; struct ubus_context *theCtx = NULL; - theWritePath = getenv ("DOMO_WRITE_PATH"); - if (theWritePath == NULL) { - - fprintf (stderr, "you should export DOMO_WRITE_PATH. with the Path of data.\n"); - return -1; - } - // Create Configs Paths... - theDevicePath = theWritePath; + theDevicePath = kConfigPath; theDevicePath += "/Devices.json"; - theTimerPath = theWritePath; + theTimerPath = kConfigPath; theTimerPath += "/Timers.json"; //printf ("DOMO PATH: %s\n", thePath.c_str());