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 114226790d..8873cac847 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 759a0b6c95..5ab04be85d 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 4ccf64e01f..f85bc7a98f 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