forked from diskoverdata/diskover-community
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiskover_worker_bot.py
executable file
·44 lines (34 loc) · 1.3 KB
/
diskover_worker_bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""diskover - Elasticsearch file system crawler
diskover is a file system crawler that index's
your file metadata into Elasticsearch.
See README.md or https://github.com/shirosaidev/diskover
for more information.
Copyright (C) Chris Park 2017-2018
diskover is released under the Apache 2.0 license. See
LICENSE for the full license text.
"""
from diskover import listen, version, config
from rq import SimpleWorker, Connection
from redis import exceptions
from datetime import datetime
import diskover_bot_module
from diskover_bot_module import redis_conn
if __name__ == "__main__":
# parse cli arguments into cliargs dictionary
cliargs_bot = vars(diskover_bot_module.parse_cliargs_bot())
print("""\033[31m
___ _ ____ _ _ ____ _ _ ____ ____ ;
|__> | ==== |-:_ [__] \/ |=== |--< ["]
____ ____ ____ _ _ _ ___ ____ ___ /[_]\\
|___ |--< |--| |/\| |___ |==] [__] | ] [ v%s
Redis RQ worker bot for diskover crawler
Crawling all your stuff.
\033[0m""" % (version))
with Connection(redis_conn):
w = SimpleWorker(listen)
if cliargs_bot['burst']:
w.work(burst=True, logging_level=cliargs_bot['loglevel'])
else:
w.work(logging_level=cliargs_bot['loglevel'])