Skip to content

Commit

Permalink
improve log sensor service daemon
Browse files Browse the repository at this point in the history
  • Loading branch information
kuronosec committed Nov 3, 2023
1 parent 6dea026 commit 7025c76
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions tikuna/sensor/log_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import threading
import logging
import sys

from os.path import join, dirname
from dotenv import load_dotenv
Expand Down
16 changes: 13 additions & 3 deletions tikuna/sensor/sensor_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,29 @@

class SensorDaemon(Daemon):

def __init__(self, pidfile, stdin='/dev/null',
stdout='/dev/null', stderr='/dev/null'):
super(Daemon, self).__init__()
self.pidfile = pidfile
self.stdin = stdin
self.stdout = stdout
self.stderr = stderr
self.log_sensor_service = None

def run(self):
logging.basicConfig(filename=log_file,
level=logging.INFO)
logging.info('Creating tikuna client services...')
log_sensor_service = LogSensor("prysm-beacon")
self.log_sensor_service = LogSensor("prysm-beacon")
# Start the services.
logging.info('Starting the tikuna client services...')
log_sensor_service.start()
self.log_sensor_service.start()
logging.info("Sensors started.")
logging.info('tikuna service client started...')

def stop(self):
# TODO: do something here?
if self.log_sensor_service is not None:
self.log_sensor_service.stop()
logging.info('Service tikuna stopped ...')

if __name__ == "__main__":
Expand Down

0 comments on commit 7025c76

Please sign in to comment.