# Cookbook Name:: utc-time
# Recipe:: default
execute "remove-old-localtime" do
command "rm /etc/localtime"
action :run
only_if { File.exists?("/etc/localtime") }
end
execute "link-utc-as-localtime" do
command "ln -sf /usr/share/zoneinfo/UTC /etc/localtime"
action :run
end
execute "service-ntp-stop" do
command "service ntp stop"
action :run
only_if { File.exists?("/etc/ntp.conf") }
end
execute "ntpdate-update" do
command "ntpdate pool.ntp.org"
action :run
only_if { File.exists?("/usr/sbin/ntpdate") }
end
execute "service-ntp-start" do
command "service ntp start"
action :run
only_if { File.exists?("/etc/ntp.conf") }
end
execute "hwclock-sync" do
command "/sbin/hwclock --systohc"
action :run
end