Saturday, 5 March 2016

Set Date & Time CentOS

#!/bin/bash

# A script to Set up the date and time

service ntpd stop
ntpdate us.pool.ntp.org
hwclock -w

mv /etc/localtime /etc/localtime.bak
ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime

service ntpd start
service mysqld restart

OR

#!/bin/bash

# A script to Set up the date and time

mv /etc/localtime /etc/localtime.bak
ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
service mysqld restart


@reboot /bin/sh /home/ec2-user/set-time.sh >> /home/ec2-user/set-time-log




No comments: