diff options
-rw-r--r-- | date.txt | 2 | ||||
-rw-r--r-- | maintenance/__init__.py | 0 | ||||
-rw-r--r-- | maintenance/admin.py | 6 | ||||
-rw-r--r-- | maintenance/apps.py | 8 | ||||
-rw-r--r-- | maintenance/management/__init__.py | 0 | ||||
-rw-r--r-- | maintenance/management/commands/__init__.py | 1 | ||||
-rw-r--r-- | maintenance/management/commands/log_generator.py | 20 | ||||
-rw-r--r-- | maintenance/migrations/__init__.py | 0 | ||||
-rw-r--r-- | maintenance/models.py | 6 | ||||
-rw-r--r-- | maintenance/tests.py | 6 | ||||
-rw-r--r-- | maintenance/views.py | 6 | ||||
-rw-r--r-- | map_machine_ids.txt | 28 | ||||
-rw-r--r-- | new_cron_job.sh | 24 | ||||
-rw-r--r-- | sbhs_server/sbhs.py | 2 | ||||
-rw-r--r-- | sbhs_server/settings.py | 7 |
15 files changed, 84 insertions, 32 deletions
@@ -1 +1 @@ -Wed Jan 4 10:58:02 IST 2017 +Fri May 26 00:00:46 IST 2017 diff --git a/maintenance/__init__.py b/maintenance/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/maintenance/__init__.py diff --git a/maintenance/admin.py b/maintenance/admin.py new file mode 100644 index 0000000..13be29d --- /dev/null +++ b/maintenance/admin.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.contrib import admin + +# Register your models here. diff --git a/maintenance/apps.py b/maintenance/apps.py new file mode 100644 index 0000000..4262aa8 --- /dev/null +++ b/maintenance/apps.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.apps import AppConfig + + +class MaintenanceConfig(AppConfig): + name = 'maintenance' diff --git a/maintenance/management/__init__.py b/maintenance/management/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/maintenance/management/__init__.py diff --git a/maintenance/management/commands/__init__.py b/maintenance/management/commands/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/maintenance/management/commands/__init__.py @@ -0,0 +1 @@ + diff --git a/maintenance/management/commands/log_generator.py b/maintenance/management/commands/log_generator.py new file mode 100644 index 0000000..95c03d0 --- /dev/null +++ b/maintenance/management/commands/log_generator.py @@ -0,0 +1,20 @@ +#Dev/KoDe :) + +import csv +import datetime +import os +import sys +from django.core.management.base import BaseCommand, CommandError + +class Command(BaseCommand): + args = '' + help = 'Creates Log' + + def handle(self, *args, **options): + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sbhs_server.settings") # To make a Django Environment. + + from sbhs_server.tables.models import Board + board_details = Board.objects.values_list("online", flat=True) + board = str([x for x in board_details]) + with open('new.csv', "a") as newcsv: + newcsv.write("{0} {1} \n".format(datetime.datetime.now(), board.replace(",", "").replace("[", "").replace("]",""))) diff --git a/maintenance/migrations/__init__.py b/maintenance/migrations/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/maintenance/migrations/__init__.py diff --git a/maintenance/models.py b/maintenance/models.py new file mode 100644 index 0000000..1dfab76 --- /dev/null +++ b/maintenance/models.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models + +# Create your models here. diff --git a/maintenance/tests.py b/maintenance/tests.py new file mode 100644 index 0000000..5982e6b --- /dev/null +++ b/maintenance/tests.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.test import TestCase + +# Create your tests here. diff --git a/maintenance/views.py b/maintenance/views.py new file mode 100644 index 0000000..e784a0b --- /dev/null +++ b/maintenance/views.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.shortcuts import render + +# Create your views here. diff --git a/map_machine_ids.txt b/map_machine_ids.txt index 7b66f9f..d586cb4 100644 --- a/map_machine_ids.txt +++ b/map_machine_ids.txt @@ -1,29 +1 @@ -32=/dev/ttyUSB2 -25=/dev/ttyUSB1 52=/dev/ttyUSB0 -15=/dev/ttyUSB30 -16=/dev/ttyUSB36 -14=/dev/ttyUSB31 -11=/dev/ttyUSB41 -1=/dev/ttyUSB40 -8=/dev/ttyUSB39 -7=/dev/ttyUSB38 -2=/dev/ttyUSB32 -13=/dev/ttyUSB37 -10=/dev/ttyUSB35 -12=/dev/ttyUSB34 -9=/dev/ttyUSB33 -20=/dev/ttyUSB28 -17=/dev/ttyUSB26 -28=/dev/ttyUSB25 -24=/dev/ttyUSB24 -22=/dev/ttyUSB23 -18=/dev/ttyUSB22 -30=/dev/ttyUSB20 -29=/dev/ttyUSB18 -3=/dev/ttyUSB13 -6=/dev/ttyUSB12 -31=/dev/ttyUSB7 -19=/dev/ttyUSB6 -23=/dev/ttyUSB5 -5=/dev/ttyUSB3 diff --git a/new_cron_job.sh b/new_cron_job.sh new file mode 100644 index 0000000..f757e20 --- /dev/null +++ b/new_cron_job.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Django 1.11 compatible + + +find $(pwd) -iname \*.pyc -exec rm -rfv {} \; #to delete all .pyc files + +DIR="$( cd "$( dirname "$0" )" && pwd )" +cd $DIR +killall streamer +source ../bin/activate +#source ./bin/activate +python sbhs_server/scan_machines.py +#python offline_reconnect.py +python manage.py makemigrations +python manage.py migrate +python manage.py initialize_machines +python manage.py generate_checksum +touch index.wsgi +python manage.py log_generator + +#python log_generator.py +date > date.txt +sleep 2
\ No newline at end of file diff --git a/sbhs_server/sbhs.py b/sbhs_server/sbhs.py index c9620e9..f7873cb 100644 --- a/sbhs_server/sbhs.py +++ b/sbhs_server/sbhs.py @@ -1,7 +1,7 @@ import serial import os from time import localtime, strftime, sleep -import sbhs_server.credentials as credentials +import credentials MAP_FILE = credentials.MAP_FILE #LOG_FILE = '../log/sbhserr.log' diff --git a/sbhs_server/settings.py b/sbhs_server/settings.py index b7ec8b7..1b6091f 100644 --- a/sbhs_server/settings.py +++ b/sbhs_server/settings.py @@ -72,6 +72,7 @@ INSTALLED_APPS = ( 'slot', 'sbhs_server.tables', 'webcam', + 'maintenance', ) MIDDLEWARE = ( @@ -236,8 +237,10 @@ WEBCAM_STATIC_DIR = 'img/webcam/' if not is_production: SBHS_ADMINS = ( - ("Amol Mandhane", "+91-9999999999", "amol_mandhane@iitb.ac.in"), - ("Amol Mandhane", "+91-9999999999", "amol_mandhane@iitb.ac.in"), + # ("Amol Mandhane", "+91-9999999999", "amol_mandhane@iitb.ac.in"), + # ("Amol Mandhane", "+91-9999999999", "amol_mandhane@iitb.ac.in"), + ('Debakanta Kar' , '0123456789' , 'kar.bubu.15@gmail.com'), + ('Deep Bhattacharyya' , '9876543210' , 'cr7.rick@gmail.com') ) else: from sbhs_server.sbhs_admin_config import SBHS_ADMINS |