Gracefuler end.

This commit is contained in:
sam 2020-09-30 00:15:40 +02:00
parent 3dff5d92af
commit 490dfb1af1
7 changed files with 56 additions and 19 deletions

View file

@ -15,6 +15,7 @@ from /team/laser
from libs3 import gstt
import argparse
import subprocess
from libs3 import settings
def handle():
@ -112,8 +113,7 @@ def handle():
# Lasers = number of laser connected otherwise will be autodetected with one minimum
if args.Lasers != None:
gstt.LaserNumber = args.Lasers
else:
gstt.LaserNumber = 1
Settings.Write()
if args.bhoroscIP != None:

View file

@ -92,7 +92,7 @@ Bob could use /pl/2/0 and /pl/2/1 and Lisa could use /pl/2/2 and /pl/2/3.
import types, time, socket
from libs3 import gstt
import redis
from libs3 import settings, plugins, homographyp
from libs3 import settings, plugins, homographyp,log
r = redis.StrictRedis(host=gstt.LjayServerIP , port=6379, db=0)
@ -333,6 +333,9 @@ def handler(oscpath, args):
print()
print("new laser number",args[0])
print()
gstt.LaserNumber = args[0]
settings.Write()
if oscpath[2] == "regen":
print()
@ -352,6 +355,7 @@ def handler(oscpath, args):
print()
gstt.debug = int(args[0])
plugins.SendAll("/debug "+str(gstt.debug))
settings.Write()
if oscpath[2] == "rescan":
@ -359,11 +363,13 @@ def handler(oscpath, args):
DAChecks()
print("Done.")
if oscpath[2] == "rstrt":
if oscpath[2] == "restart":
print()
print("Restarting", args[0], "...")
if args[0] == "lj":
raise Restart(time.asctime())
LJautokill()
import os
os.execv(sys.executable, ['python3'] + sys.argv)
else:
plugins.Restart(args[0])
print()
@ -586,6 +592,31 @@ def isconnected(IP):
time.sleep(delay)
return ipup
'''
def LJautokill():
log.warn("LJ stopping...")
print(gstt.LaserNumber,"Tracers launched")
lasernumber= gstt.LaserNumber -1
log.warn("Killing tracer0...")
worker0.join()
if lasernumber >0:
log.warn("Killing tracer1...")
worker1.join()
if lasernumber >1:
log.warn("Killing tracer2...")
worker2.join()
if lasernumber >2:
log.warn("Killing tracer3...")
worker3.join()
log.warn("Laser feedbacks resetting...")
for laserid in range(0,lasernumber+1):
r.set('/lack/'+str(laserid),64)
r.set('/lstt/'+str(laserid),64)
r.set('/cap/'+str(laserid),0)
log.infog("LJ stopped.")
# autodetect DACs in LJ.conf.
def DAChecks():

View file

@ -23,7 +23,7 @@ ljpath=''
anims= [[],[],[],[]]
# How many lasers are connected. Different that "currentlaser" and "dacnumber" (=autodetected)
LaserNumber = -1
LaserNumber = 4
# What laser client to listen at launch
SceneNumber = 0