diff --git a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/src/main/java/org/wso2/carbon/appmgt/mdm/restconnector/internal/MDMComponent.java b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/src/main/java/org/wso2/carbon/appmgt/mdm/restconnector/internal/MDMComponent.java index c75ed0981..e1830d425 100644 --- a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/src/main/java/org/wso2/carbon/appmgt/mdm/restconnector/internal/MDMComponent.java +++ b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/src/main/java/org/wso2/carbon/appmgt/mdm/restconnector/internal/MDMComponent.java @@ -37,15 +37,10 @@ public class MDMComponent { protected void activate(ComponentContext context) { BundleContext bundleContext = context.getBundleContext(); + mdmServiceRegistration = bundleContext.registerService(ApplicationOperations.class.getName(), new + ApplicationOperationsImpl(), null); if (log.isDebugEnabled()) { - log.debug("WSO2MDM MDM Component activated"); - } - try { - mdmServiceRegistration = bundleContext.registerService(ApplicationOperations.class.getName(), new - ApplicationOperationsImpl(), null); - } catch (Throwable e) { - log.error("Failed to activate org.wso2.carbon.appmgt.mdm.restconnector.internal." + - "MDMComponent : " + e); + log.debug("WSO2MDM MDM Component activated."); } } diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/RaspberryService.sh b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/RaspberryService.sh index 114226790..8873cac84 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/RaspberryService.sh +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/RaspberryService.sh @@ -15,7 +15,7 @@ DESC="This service is used to publish events from the Raspberry Pi to the WSO2 D NAME=RaspberryStats DIR=/usr/local/src/RaspberryAgent/src/ -DAEMON=python $DIR/RaspberryAgent.py +DAEMON=$DIR/RaspberryAgent.py DAEMON_NAME=$NAME SCRIPTNAME=RaspberryService.sh @@ -39,6 +39,7 @@ DAEMON_USER=root #pi do_start () { log_daemon_msg "Starting system $DAEMON_NAME daemon" start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user $DAEMON_USER --chuid $DAEMON_USER --startas $DAEMON -- $DAEMON_OPTS + python $DAEMON & log_end_msg $? } do_stop () { diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/src/RaspberryAgent.py b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/src/RaspberryAgent.py index 759a0b6c9..5ab04be85 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/src/RaspberryAgent.py +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/src/RaspberryAgent.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin python """ /** * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. @@ -23,7 +23,8 @@ import logging, logging.handlers import sys, os, signal, argparse import running_mode import time, threading, datetime, calendar -import iotUtils, mqttConnector, Adafruit_DHT, httpServer +import iotUtils, mqttConnector, httpServer +import Adafruit_DHT # import httplib, ssl # from functools import wraps diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/startService.sh b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/startService.sh index 4ccf64e01..f85bc7a98 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/startService.sh +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/startService.sh @@ -46,9 +46,9 @@ sudo python Adafruit_Python_DHT/setup.py install sudo cp $currentDir/deviceConfig.properties $currentDir/src sudo cp -r $currentDir/src $destination -sudo chmod +x $destination/src/RaspberryAgent.py +sudo chmod 755 $destination/src/RaspberryAgent.py sudo update-rc.d -f RaspberryService.sh remove sudo cp $currentDir/RaspberryService.sh /etc/init.d -sudo chmod +x /etc/init.d/RaspberryService.sh +sudo chmod 755 /etc/init.d/RaspberryService.sh sudo update-rc.d RaspberryService.sh defaults sudo service RaspberryService.sh start