Skip to content

Commit

Permalink
improves tikuna log collection daemon service
Browse files Browse the repository at this point in the history
  • Loading branch information
kuronosec committed Jan 27, 2024
1 parent 8ef7cdb commit 75781be
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
data
.env*
venv*
*_env
10 changes: 8 additions & 2 deletions tikuna/sensor/daemon.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import sys, os, time, atexit
import socket
from signal import SIGTERM

data_path = "/var/lib/tikuna/data"
log_path = "/var/log/tikuna/"
log_file = "%s/%s-tikuna-sensor.log" % (log_path, socket.gethostname())
pid_file = "/var/lib/tikuna/tikuna-sensor.pid"

# A base and generic class for creating Linux deamons

class Daemon:

def __init__(self, pidfile, stdin='/dev/null',
stdout='/dev/null', stderr='/dev/null'):
self.stdin = stdin
self.stdout = stdout
self.stderr = stderr
self.stdout = log_file
self.stderr = log_file
self.pidfile = pidfile

def daemonize(self):
Expand Down
4 changes: 2 additions & 2 deletions tikuna/sensor/sensor_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def __init__(self, pidfile, stdin='/dev/null',
super(Daemon, self).__init__()
self.pidfile = pidfile
self.stdin = stdin
self.stdout = stdout
self.stderr = stderr
self.stdout = log_file
self.stderr = log_file
self.log_sensor_service = None

def run(self):
Expand Down

0 comments on commit 75781be

Please sign in to comment.