Blame view

src/majordome/start_agent_majordome.py 912 Bytes
03814884   Etienne Pallier   launch majordome ...
1
#!/usr/bin/env python
b4e8963c   Etienne Pallier   Each agent (envmo...
2
3
4

import os
import sys
d51386bf   Etienne Pallier   new file majordom...
5
6
from django.conf import settings as djangosettings

b70385ab   Etienne Pallier   bugfixing pyros s...
7
8
9
10
11
FOR_REAL = True
if len(sys.argv) == 2 and sys.argv[1] == "test":
    FOR_REAL = False
print("FOR_REAL is", FOR_REAL)

b4e8963c   Etienne Pallier   Each agent (envmo...
12
13
14
15

# DJANGO setup
#sys.path.append('/PROJECTS/GFT/SOFT/PYROS_SOFT/PYROS201802')
sys.path.append('..')
03814884   Etienne Pallier   launch majordome ...
16
#print("file is", __file__)
d51386bf   Etienne Pallier   new file majordom...
17
#mypath = os.getcwd()
03814884   Etienne Pallier   launch majordome ...
18

b4e8963c   Etienne Pallier   Each agent (envmo...
19
20
21
22
23
24
25
26
27
# 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()

d51386bf   Etienne Pallier   new file majordom...
28
29
30
print("DB2 used is:", djangosettings.DATABASES['default']['NAME'])


b4e8963c   Etienne Pallier   Each agent (envmo...
31
32
33
34
35
# MONITORING AGENT setup
agent="majordome"

if agent=="majordome":
    from majordome.tasks import Majordome
d243a3ef   Etienne Pallier   Bugfix majordome_...
36
    # Run agent Majordome without actual commands sent to devices (FOR_REAL=False)
b70385ab   Etienne Pallier   bugfixing pyros s...
37
    Majordome().run(FOR_REAL)