Class: Bixby::Provision::NTP
- Defined in:
- lib/bixby/provision/dsl/ntp.rb
Constant Summary collapse
- EXPORTS =
[]
- DEFAULT_NTP_POOL =
"ntp.ubuntu.com"
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(*args) ⇒ NTP
constructor
A new instance of NTP.
- #set(server = DEFAULT_NTP_POOL) ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Methods inherited from Base
#get_gid, #get_group, #get_uid, #get_user, #tap, #tempfile
Methods included from Util::File
#chmod, #chown, #sha256sum, #which
Constructor Details
#initialize(*args) ⇒ NTP
Returns a new instance of NTP.
11 12 13 14 15 16 17 18 |
# File 'lib/bixby/provision/dsl/ntp.rb', line 11 def initialize(*args) super @service = if ubuntu? then "ntp" elsif centos? or amazon? then "ntpd" end end |
Instance Method Details
#set(server = DEFAULT_NTP_POOL) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/bixby/provision/dsl/ntp.rb', line 20 def set(server=DEFAULT_NTP_POOL) logger.info "ntp.set using #{server}" sys.package "ntpdate" stop logged_sudo("ntpdate #{server}", :env => { "PATH" => PATH } ) start end |
#start ⇒ Object
28 29 30 |
# File 'lib/bixby/provision/dsl/ntp.rb', line 28 def start service.start @service end |
#stop ⇒ Object
32 33 34 |
# File 'lib/bixby/provision/dsl/ntp.rb', line 32 def stop service.stop @service end |