-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.html
More file actions
61 lines (56 loc) · 2.75 KB
/
README.html
File metadata and controls
61 lines (56 loc) · 2.75 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Introduccion</title>
<style>
</style>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Microsoft/vscode/extensions/markdown-language-features/media/markdown.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Microsoft/vscode/extensions/markdown-language-features/media/highlight.css">
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif;
font-size: 14px;
line-height: 1.6;
}
</style>
<style>
.task-list-item { list-style-type: none; } .task-list-item-checkbox { margin-left: -20px; vertical-align: middle; }
</style>
</head>
<body class="vscode-light">
<h1 id="introduccion">Introduccion</h1>
<p>Los scripts están escritos en python3 y utilizan SQLite.
Tanto <a href="http://receiver.py">receiver.py</a> como <a href="http://sender.py">sender.py</a> deben configurarse en el sistema operativo para ejecutarse automáticamente cada cierto tiempo.</p>
<h2 id="configuración-de-cronjobs">Configuración de cronjobs</h2>
<ol>
<li>Crear scripts bash para los scripts python.<br>
<a href="http://script-bash1.sh">script-bash1.sh</a></li>
</ol>
<pre><code><code><div>#!/bin/bash
python3 receiver.py
</div></code></code></pre>
<p><a href="http://script-bash2.sh">script-bash2.sh</a></p>
<pre><code><code><div>#!/bin/bash
python3 sender.py
</div></code></code></pre>
<ol start="2">
<li>Añadir las lineas en el archivo crontab. Para editar el archivo ejecutamos <code>sudo crontab -e</code> y añadimos las siguientes lineas.</li>
</ol>
<pre><code><code><div>@reboot sh /home/pi/script-bash1.sh >/home/pi/logs/cronlog 2>&1
*/2 * * * * /home/pi/justdiedbot/script-bash1.sh >/home/pi/logs/cronlog.log 2>&1
@reboot sh /home/pi/script-bash2.sh >/home/pi/logs/cronlog 2>&1
*/2 * * * * /home/pi/justdiedbot/script-bash2.sh >/home/pi/logs/cronlog.log 2>&1
</div></code></code></pre>
<p>Las lineas anteriores ejecutan ambos scripts cada 2 minutos.</p>
<h1 id="archivos-y-scripts">Archivos y scripts</h1>
<h2 id="receiverpy"><a href="http://receiver.py">receiver.py</a></h2>
<p>Script para leer los datos que se reciben en el puerto USB y almacenarlos en la base de datos.</p>
<h2 id="senderpy"><a href="http://sender.py">sender.py</a></h2>
<p>Script para enviar los datos de la base de datos al endpoint de la API.</p>
<h2 id="database_scriptspy">database_scripts.py</h2>
<p>Contiene funciones para interactuar con la base de datos.</p>
<h2 id="miscpy"><a href="http://misc.py">misc.py</a></h2>
<p>Contiene funciones varias.</p>
</body>
</html>