mirror of https://github.com/CIRCL/lookyloo
chg: Sync stop script with template
parent
5e5206ae00
commit
a55fb5380a
21
bin/stop.py
21
bin/stop.py
|
@ -4,6 +4,7 @@
|
||||||
from subprocess import Popen, run
|
from subprocess import Popen, run
|
||||||
|
|
||||||
from redis import Redis
|
from redis import Redis
|
||||||
|
from redis.exceptions import ConnectionError
|
||||||
|
|
||||||
from lookyloo.default import get_homedir, get_socket_path
|
from lookyloo.default import get_homedir, get_socket_path
|
||||||
|
|
||||||
|
@ -12,14 +13,18 @@ def main():
|
||||||
get_homedir()
|
get_homedir()
|
||||||
p = Popen(['shutdown'])
|
p = Popen(['shutdown'])
|
||||||
p.wait()
|
p.wait()
|
||||||
r = Redis(unix_socket_path=get_socket_path('cache'), db=1)
|
try:
|
||||||
r.delete('shutdown')
|
r = Redis(unix_socket_path=get_socket_path('cache'), db=1)
|
||||||
r = Redis(unix_socket_path=get_socket_path('cache'))
|
r.delete('shutdown')
|
||||||
r.delete('tree_cache')
|
r = Redis(unix_socket_path=get_socket_path('cache'))
|
||||||
print('Shutting down databases...')
|
r.delete('tree_cache')
|
||||||
p = run(['run_backend', '--stop'])
|
print('Shutting down databases...')
|
||||||
p.check_returncode()
|
p_backend = run(['run_backend', '--stop'])
|
||||||
print('done.')
|
p_backend.check_returncode()
|
||||||
|
print('done.')
|
||||||
|
except ConnectionError:
|
||||||
|
# Already down, skip the stacktrace
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue