You are not logged in.

#1 2012-10-28 06:26:43

mukti
Member
From: New Jersey, USA
Registered: 2012-01-25
Posts: 28

Sync ntp only when connected

Now that I've moved to systemd, I cannot start hwclock at boot. The laptop I use is not always connected to a network, so I don't want the ntp client, and don't want to constantly have errors because it can't find a server. I was recommended "chrony", but it looks like I'll manually have to tell chrony when i am conneceted to a network each time I connect. Does anyone know how I could script chrony to sync only when connected, or does anyone know a better package to use?

Offline

#2 2012-10-28 08:37:08

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Sync ntp only when connected

It depends how you connect - so, how do you connect to the network?

chrony.txt shows an example for when PPP is used.

Offline

#3 2012-10-28 09:23:22

illusionist
Member
From: localhost
Registered: 2012-04-03
Posts: 498

Re: Sync ntp only when connected

This may help
Link


  Never argue with stupid people,They will drag you down to their level and then beat you with experience.--Mark Twain
@github

Offline

#4 2012-10-28 17:37:44

mukti
Member
From: New Jersey, USA
Registered: 2012-01-25
Posts: 28

Re: Sync ntp only when connected

brebs wrote:

It depends how you connect - so, how do you connect to the network?

chrony.txt shows an example for when PPP is used.

I use wicd to connect to my AP, and no network services (besides wicd) are started at boot. When I want to connect, I open wicd (or run wicd-curses) and select my AP. Most of my settings are already saved, but I thought I could write a script that works when wicd obtains a connection like:

#! /bin/sh
chronyc password <password>
chronyc online
chronyc exit

and another script when wicd disconnects (or the system powers off) like:

#! /bin/sh
chronyc password <password>
chronyc offline
chronyc exit

I'll take a look at the PPP example, and see if I can work off that, thanks.

Last edited by mukti (2012-10-28 17:38:35)

Offline

Board footer

Powered by FluxBB