-
Notifications
You must be signed in to change notification settings - Fork 165
Expand file tree
/
Copy pathbeaver
More file actions
executable file
·31 lines (26 loc) · 932 Bytes
/
beaver
File metadata and controls
executable file
·31 lines (26 loc) · 932 Bytes
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from beaver.dispatcher.tail import run as tail_run
from beaver.dispatcher.worker import run as worker_run
from beaver.pidfile import PidFile
from beaver.utils import CAN_DAEMONIZE, parse_args, version
args = parse_args()
version(args)
if args.daemonize:
assert CAN_DAEMONIZE, "Daemonization is unimplemented on the Windows Platform"
assert args.pid, "A pid path must be specified in the beaver config or via the -P flag"
import daemon
if args.output:
context = daemon.DaemonContext(pidfile=PidFile(args.pid), stdout=open(args.output, "wb"), stderr=open(args.output, "wb"))
else:
context = daemon.DaemonContext(pidfile=PidFile(args.pid))
with context:
if args.experimental:
tail_run(args)
else:
worker_run(args)
else:
if args.experimental:
tail_run(args)
else:
worker_run(args)