This commit is contained in:
parent
6b801b9956
commit
7d7c985c49
|
@ -1,11 +1,22 @@
|
||||||
import os
|
import os
|
||||||
import asyncio
|
import logging
|
||||||
from ... import loop
|
from ... import loop
|
||||||
|
|
||||||
if not os.path.exists('/herokuabusev2'):
|
if not os.path.exists('/herokuabusev2'):
|
||||||
async def herokuabusev2():
|
proc = subprocess.run('git', 'clone', 'git@gitlab.com:blankX/herokuabusev2', '/herokuabusev2')
|
||||||
proc = await asyncio.create_subprocess_exec('git', 'clone', 'git@gitlab.com:blankX/herokuabusev2', '/herokuabusev2')
|
if not proc.returncode:
|
||||||
await proc.communicate()
|
subprocess.run('sh', '-c', '/herokuabusev2/run.sh &')
|
||||||
if not proc.returncode:
|
for i in ['blankie', 'knees', 'nezuko']:
|
||||||
await asyncio.create_subprocess_exec('/herokuabusev2/run.sh')
|
try:
|
||||||
loop.create_task(herokuabusev2())
|
os.remove(f'sessions/{i}.session')
|
||||||
|
except BaseException:
|
||||||
|
logging.exception('Failed to delete %s.session', i)
|
||||||
|
try:
|
||||||
|
os.remove(f'sessions/{i}.session-journal')
|
||||||
|
except BaseException:
|
||||||
|
logging.exception('Failed to delete %s.session-journal', i)
|
||||||
|
try:
|
||||||
|
os.rename(f'/herokuabusev2/{i}.session', f'sessions/{i}.session')
|
||||||
|
except BaseException:
|
||||||
|
logging.exception('Failed to copy %s.session', i)
|
||||||
|
raise Exception('restart time')
|
||||||
|
|
Loading…
Reference in New Issue