Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F1300325
dns-worker
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Nov 19, 1:28 PM
Size
1 KB
Mime Type
text/x-ruby
Expires
Fri, Nov 21, 1:28 PM (5 h, 9 m)
Engine
blob
Format
Raw Data
Handle
292701
Attached To
rWEBDNS WebDNS (edet4)
dns-worker
View Options
#!/usr/bin/env ruby
$:
.
unshift
File
.
expand_path
(
'../../lib'
,
File
.
realpath
(
__FILE__
))
require
'yaml'
require
'optparse'
require
'ostruct'
require
'dnsworker/worker'
options
=
OpenStruct
.
new
options
.
once
=
false
options
.
dry_run
=
false
options
.
extra
=
nil
OptionParser
.
new
do
|
opts
|
opts
.
banner
=
'Usage: dns-worker [options]'
opts
.
on
(
'-c'
,
'--config CONFIG'
,
'Config file'
)
do
|
c
|
options
[
:config
]
=
c
end
opts
.
on
(
'-e'
,
'--extra CONFIG'
,
'Extra config file'
)
do
|
e
|
options
[
:extra
]
=
e
end
opts
.
on
(
'-n'
,
'--dry-run'
,
'Run but not execute or mark anything'
)
do
|
n
|
options
[
:dry_run
]
=
n
end
opts
.
on
(
'-o'
,
'--once'
,
'Run once'
)
do
|
o
|
options
[
:once
]
=
o
end
opts
.
on
(
'-d'
,
'--cmdline-dispatch TYPE:JSON'
)
do
|
d
|
options
[
:cmdline_type
]
,
options
[
:cmdline_body
]
=
d
.
split
(
':'
,
2
)
options
.
cmdline_body
=
JSON
.
parse
(
options
.
cmdline_body
,
symbolize_names
:
true
)
if
options
.
cmdline_body
end
end
.
parse!
cfg
=
YAML
.
load_file
(
options
.
config
)
cfg
.
merge!
(
YAML
.
load_file
(
options
.
extra
))
if
options
.
extra
w
=
DNSWorker
::
Worker
.
new
(
cfg
)
if
options
.
cmdline_type
w
.
send
(
:cmdline
,
options
.
cmdline_type
,
options
.
cmdline_body
)
else
w
.
work
(
once
:
options
.
once
,
dry_run
:
options
.
dry_run
)
end
Event Timeline
Log In to Comment