how to set time?

General questions about the FreeBSD operating system. Ask here if your question does not fit elsewhere.

how to set time?

Postby hirohitosan » 21 Jan 2009, 13:10

Sorry for this question, but how to set hour in FreBSD. I set the time zone at installation but after starting X I realize that my clock is not set.

there is a tool for setting time?

tahnks
User avatar
hirohitosan
Member
 
Posts: 279
Joined: 24 Nov 2008, 11:52

Postby kamikaze » 21 Jan 2009, 13:18

You can set the time with the [man=1]date[/man] command.

You can also run ntpd to automatically sync your time with a time server.
sysutils/bsdadminscripts: binary package maintenance, library integrity checking, ...
sysutils/automounter: [man=8]amd[/man] based automounting without HAL
contact: kamikaze@bsdforen.de

Disclaimer: My posts represent my perception. Errors and incompleteness are to be expected, I deny any responsibility to know everything.
User avatar
kamikaze
Member
 
Posts: 366
Joined: 17 Nov 2008, 07:34
Location: /earth/europe/germany

Postby sniper007 » 21 Jan 2009, 13:21

If anything can go wrong, it will. If it can't, it will anyway
User avatar
sniper007
Member
 
Posts: 110
Joined: 17 Nov 2008, 09:18
Location: Slovenia

Postby hirohitosan » 21 Jan 2009, 14:51

Thanks guys
I add in /etc/rc.conf
Code: Select all
ntpdate_enable="YES"

and create the file /etc/ntp.conf
and add
Code: Select all
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server pool.ntp.org
driftfile /var/db/ntp.drift
User avatar
hirohitosan
Member
 
Posts: 279
Joined: 24 Nov 2008, 11:52

Postby DutchDaemon » 21 Jan 2009, 15:20

I'd advise using openntpd (from ports), which will not open a listener on port 123 (which only ntp servers need) unless you tell it to.
User avatar
DutchDaemon
Old Fart
 
Posts: 10467
Joined: 16 Nov 2008, 20:17
Location: The Netherlands

Postby SirDice » 21 Jan 2009, 15:46

I also advise, if possible, to use the ISP's ntp server.
User avatar
SirDice
Old Fart
 
Posts: 16196
Joined: 17 Nov 2008, 16:50
Location: Rotterdam, Netherlands

Postby DutchDaemon » 21 Jan 2009, 15:51

Sure. I lack enthusiasm for the pool.ntp.org servers. I've seen weird (big) time shifts (and associated alerts from panicking applications) when using those. They're not exactly 'professional' time servers, and they vary wildly in stratum quality.
User avatar
DutchDaemon
Old Fart
 
Posts: 10467
Joined: 16 Nov 2008, 20:17
Location: The Netherlands

Postby sniper007 » 21 Jan 2009, 16:08

I had problems with openntpd and Freebsd 7.1. With Freebsd 6.4 works fine.
If anything can go wrong, it will. If it can't, it will anyway
User avatar
sniper007
Member
 
Posts: 110
Joined: 17 Nov 2008, 09:18
Location: Slovenia

Postby DutchDaemon » 21 Jan 2009, 16:28

Running openntpd on 7.1-STABLE (Jan 6 & Jan 8 builds) without a hitch. Haven't recompiled recently; the binary is dated March 4.
User avatar
DutchDaemon
Old Fart
 
Posts: 10467
Joined: 16 Nov 2008, 20:17
Location: The Netherlands

Postby SirDice » 21 Jan 2009, 23:10

hirohitosan wrote:Thanks guys
I add in /etc/rc.conf
Code: Select all
ntpdate_enable="YES"


Do note that ntpdate will only set/correct the time when the system is booted.
If you want to keep the time correct continuously try ntpd (base) or openntpd (port).
User avatar
SirDice
Old Fart
 
Posts: 16196
Joined: 17 Nov 2008, 16:50
Location: Rotterdam, Netherlands

Postby hirohitosan » 22 Jan 2009, 09:29

Thanks again.
I installed openntpd (from ports), and add in rc.conf
ntpd_enable="YES"
and crate /etc/ntpd.conf, add time server, reboot (I couldn't find a more elegant way) and seems to work well.
User avatar
hirohitosan
Member
 
Posts: 279
Joined: 24 Nov 2008, 11:52

Postby DutchDaemon » 22 Jan 2009, 09:46

You'll need openntpd_enable="YES" .. and openntpd's config is in /usr/local/etc/ntpd.conf !
User avatar
DutchDaemon
Old Fart
 
Posts: 10467
Joined: 16 Nov 2008, 20:17
Location: The Netherlands

Postby nilsson » 22 Jan 2009, 10:34

I've been running ntpdate in cron and it seems to do the job. Am I missing something?
nilsson
Junior Member
 
Posts: 4
Joined: 11 Jan 2009, 19:27

Postby sniper007 » 22 Jan 2009, 10:42

Why you don't read handbook ? It's FREE :e

Basic Configuration

If you only wish to synchronize your clock when the machine boots up, you can use ntpdate(8). This may be appropriate for some desktop machines which are frequently rebooted and only require infrequent synchronization, but most machines should run ntpd(8).

Using ntpdate(8) at boot time is also a good idea for machines that run ntpd(8). The ntpd(8) program changes the clock gradually, whereas ntpdate(8) sets the clock, no matter how great the difference between a machine's current clock setting and the correct time.

To enable ntpdate(8) at boot time, add ntpdate_enable="YES" to /etc/rc.conf. You will also need to specify all servers you wish to synchronize with and any flags to be passed to ntpdate(8) in ntpdate_flags.

To ensure the NTP server is started at boot time, add the line ntpd_enable="YES" to /etc/rc.conf. If you wish to pass additional flags to ntpd(8), edit the ntpd_flags parameter in /etc/rc.conf.

To start the server without rebooting your machine, run ntpd being sure to specify any additional parameters from ntpd_flags in /etc/rc.conf. For example:

# ntpd -p /var/run/ntpd.pid

If anything can go wrong, it will. If it can't, it will anyway
User avatar
sniper007
Member
 
Posts: 110
Joined: 17 Nov 2008, 09:18
Location: Slovenia


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest