start_agent_majordome.py
912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python
import os
import sys
from django.conf import settings as djangosettings
FOR_REAL = True
if len(sys.argv) == 2 and sys.argv[1] == "test":
FOR_REAL = False
print("FOR_REAL is", FOR_REAL)
# DJANGO setup
#sys.path.append('/PROJECTS/GFT/SOFT/PYROS_SOFT/PYROS201802')
sys.path.append('..')
#print("file is", __file__)
#mypath = os.getcwd()
# Go into src/
os.chdir('..')
#print("Current directory : " + str(os.getcwd()))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "src.pyros.settings")
#os.environ['SECRET_KEY'] = 'abc'
#os.environ['ENVIRONMENT'] = 'production'
import django
django.setup()
print("DB2 used is:", djangosettings.DATABASES['default']['NAME'])
# MONITORING AGENT setup
agent="majordome"
if agent=="majordome":
from majordome.tasks import Majordome
# Run agent Majordome without actual commands sent to devices (FOR_REAL=False)
Majordome().run(FOR_REAL)