История изменений
Исправление qulinxao3, (текущая версия) :
import os.path
from time import sleep
from shlex import split
from subprocess import call
from random import randint
from datetime import datetime
p='/tmp/signal1'
if (Sig:=lambda:os.path.isfile(p))():os.remove(p); exit()
open(p, "w").close()
def doSh(a=1):
call(split(f'env DISPLAY=:0 sh /home/diver/Скрипты/l21{a}.sh'))
print(f'{a}\n{datetime.now()}')
call(split('env DISPLAY=:0 lua /home/diver/Скрипты/lo.lua'))
while Sig():
doSh(1);print(x:=float(f"0.{randint(112, 216)}")); sleep(x)
doSh(2);print(x:=randint(311, 540))
set(sleep(1)for i in range(x)if Sig())
Исходная версия qulinxao3, :
import os.path
from time import sleep
from shlex import split
from subprocess import call
from random import randint
from datetime import datetime
p='/tmp/signal1'
if (Sig:=lambda:os.path.isfile(p))():os.remove(p); exit()
open(p, "w").close()
def doSh(a=1):
call(split(f'env DISPLAY=:0 sh /home/diver/Скрипты/l21{a}.sh'))
print(f'{a}\n{datetime.now()}')
call(split('env DISPLAY=:0 lua /home/diver/Скрипты/lo.lua'))
while Sig():
doSh(1);print(x:=float(f"0.{randint(112, 216)}")); sleep(x)
doSh(2);print(x:=randint(311, 540))
set(sleep(1)for i in range(x)if Sig())