Basically ntpdate command synchronize the clock with specified ntp server. To synchronize the clock with ntp server all the time when you start your machine do the followings.
First Create a file named setdate with any editor and write the following line in the file
#!/bin/bash
case "$1" in
start)
ntpdate sol(ntp server)
;;
stop)
;;
esac
exit 0
copy the file(setdate) by the following command to the location /etc/init.d/
# cp setdate /etc/init.d/setdate
# chmod 751 /etc/init.d/setdate
Now create startup scripts to sync the time during system boot.
# update-rc.d setdate defaults
Also run tzselect to define time change(super user/normal user), Change timezone in /etc/timezone file and put the following line in /etc/bash.bashrc file, user's .bashrc' and .bash_profile file which user you want to get syncronized
TZ='Asia/Dhaka'; export TZ;
Reboot your machine to get effects.
0 comments:
Post a Comment