Merge pull request #580 from Savidude/master

Configuring the Raspberry Pi agent to run as a service
revert-dabc3590
Ruwan 8 years ago committed by GitHub
commit 46499667ea

@ -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 () {

@ -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

@ -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

Loading…
Cancel
Save