add: script to restart run.py and pigpiod, example rc.local
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import matplotlib #speed?
|
import matplotlib
|
||||||
matplotlib.use('TkAgg')
|
matplotlib.use('Agg')
|
||||||
|
|
||||||
from matplotlib import pyplot as plt
|
from matplotlib import pyplot as plt
|
||||||
from matplotlib import units
|
from matplotlib import units
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ except:
|
|||||||
import signal
|
import signal
|
||||||
import thread
|
import thread
|
||||||
import time
|
import time
|
||||||
|
#from multiprocessing import Process
|
||||||
|
|
||||||
class RFID:
|
class RFID:
|
||||||
|
|
||||||
@@ -17,7 +17,12 @@ class RFID:
|
|||||||
signal.signal(signal.SIGINT, self.stop)
|
signal.signal(signal.SIGINT, self.stop)
|
||||||
self.callback = callbackf
|
self.callback = callbackf
|
||||||
self.loop = True
|
self.loop = True
|
||||||
thread.start_new_thread(self.read, ())
|
if 1:
|
||||||
|
thread.start_new_thread(self.read, ())
|
||||||
|
else:
|
||||||
|
p = Process(target=self.read, args=())
|
||||||
|
p.start()
|
||||||
|
p.join()
|
||||||
|
|
||||||
def read(self):
|
def read(self):
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
18
rc.local.example
Normal file
18
rc.local.example
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
sleep 1
|
||||||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 5000
|
||||||
|
echo "iptables nat started"
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
sudo pigpiod
|
||||||
|
echo "pigpiod started"
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
cd /home/pi/baroness && sudo ./restart.sh' &
|
||||||
|
echo "baroness started"
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
10
restart.sh
Executable file
10
restart.sh
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
while true; do
|
||||||
|
su - pi -c 'cd /home/pi/baroness && FRAMEBUFFER=/dev/fb1 startx ./run.py'
|
||||||
|
now=$(date)
|
||||||
|
echo "Current time : $now" >> restart.log
|
||||||
|
killall pigpiod
|
||||||
|
sleep 5
|
||||||
|
pigpiod
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user