[SLE] Modifying a script for changing system-time.
Hi, I have a perl-script to modify the system-time of my laptop. While I was connected to my university's broadband, I could run this via cron once per day. Now I have only dial-up at my home, so really can't determine whether I will be online, when this script runs. I would pretty much modify the script e.g. just to avoid errors mailed to me, that first it should check that we are online (dialed-in) or not and do setting the time only in the first case. My first idea was to ping e.g. www.google.com or a similar always-on machine, but I didn't manage to interpret it. Does anyone have a few-line home-baked idea for such a task and would share it with me? Thank you in advance, Pelibali -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
pelibali wrote:
I have a perl-script to modify the system-time of my laptop.
Using perl sounds like overkill :-) - doesn't ntpdate cover it?
While I was connected to my university's broadband, I could run this via cron once per day. Now I have only dial-up at my home, so really can't determine whether I will be online, when this script runs.
So you run it as part of your dial-in procedure. It's been awhile since I've used dial-in, but I'm sure there a place where you can add a hook and get your system time set once the connection is up. /Per Jessen, Zürich -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
Hi, On Tue, 11 Jul 2006 19:37:44 +0200 Per Jessen <.> wrote:
pelibali wrote:
I have a perl-script to modify the system-time of my laptop.
Using perl sounds like overkill :-) - doesn't ntpdate cover it?
Yeah sure, I load it from a perl-script, just together with hwclock ;)))
While I was connected to my university's broadband, I could run this via cron once per day. Now I have only dial-up at my home, so really can't determine whether I will be online, when this script runs.
So you run it as part of your dial-in procedure. It's been awhile since I've used dial-in, but I'm sure there a place where you can add a hook and get your system time set once the connection is up.
I think I can't simply run it like this, because we have various comps in our network and usually I'm not the one dialling in through the router's (SUSE 10.0) opened smpppd. Anyway thanks, Pelibali -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
Hi,
On Tue, 11 Jul 2006 19:37:44 +0200 Per Jessen <.> wrote:
pelibali wrote:
I have a perl-script to modify the system-time of my laptop.
Using perl sounds like overkill :-) - doesn't ntpdate cover it?
Yeah sure, I load it from a perl-script, just together with hwclock ;)))
While I was connected to my university's broadband, I could run this via cron once per day. Now I have only dial-up at my home, so really can't determine whether I will be online, when this script runs.
So you run it as part of your dial-in procedure. It's been awhile since I've used dial-in, but I'm sure there a place where you can add a hook and get your system time set once the connection is up.
I think I can't simply run it like this, because we have various comps in our network and usually I'm not the one dialling in through the router's (SUSE 10.0) opened smpppd. Install ntp on the router, and configure it to start on boot. It will, of course, be unable to connect to any time servers until a dial-up connection is established, but at the same time should be able to
On 11/07/06 12:03, pelibali wrote: provide reasonable time control during times when it is not connected. Once you are satisfied ntp is operating satisfactorily as a client on the internet, configure it as a time server for your internal network, and configure ntp in client-only mode on your personal system (to start at boot, of course) to use the router as a time server. Now you don't care if the dial-up connection is already established or not. As a less attractive alternative, you can configure ntp in server-only mode on the router, and use adjtimex in the dial-up script to reset the router's system time when a connection is established. Again configure ntp in client mode on your personal system to use the router as a time server. -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
pelibali wrote:
Hi,
I have a perl-script to modify the system-time of my laptop. While I was connected to my university's broadband, I could run this via cron once per day. Now I have only dial-up at my home, so really can't determine whether I will be online, when this script runs. I would pretty much modify the script e.g. just to avoid errors mailed to me, that first it should check that we are online (dialed-in) or not and do setting the time only in the first case. My first idea was to ping e.g. www.google.com or a similar always-on machine, but I didn't manage to interpret it.
ping -c1 www.google.com >/dev/null 2>&1 && ntpdate -w pool.ntp.org might do the job. As Per wrote, adding the ntpdate command to the dial-up script is better, if you dial-up with your laptop and not with a router. Joachim -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Joachim Schrod Email: jschrod@acm.org Roedermark, Germany -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Tuesday 2006-07-11 at 20:51 +0200, Joachim Schrod wrote:
ping -c1 www.google.com >/dev/null 2>&1 && ntpdate -w pool.ntp.org
might do the job.
Even simpler: call ntpdate directly; if there is no network, it will fail - - so what? ;-) An alternative I prefer is calling "rcntp ntptimeset" instead. It will use the "/etc/ntp.conf" to know the servers to set time from. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFEtOi3tTMYHG2NR9URAt6WAKCRomtmBeS9G/QLdCotja3RVwWVTQCfTX6g BwY/XcrYEgfGgP181W7egHE= =OYBH -----END PGP SIGNATURE----- -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
On Tue, 2006-07-11 at 19:13 +0200, pelibali wrote:
Hi,
I have a perl-script to modify the system-time of my laptop. While I was connected to my university's broadband, I could run this via cron once per day. Now I have only dial-up at my home, so really can't determine whether I will be online, when this script runs. I would pretty much modify the script e.g. just to avoid errors mailed to me, that first it should check that we are online (dialed-in) or not and do setting the time only in the first case. My first idea was to ping e.g. www.google.com or a similar always-on machine, but I didn't manage to interpret it.
Does anyone have a few-line home-baked idea for such a task and would share it with me?
Less a script and more an idea. How about NTP? It will access a proper time server. -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
pelibali wrote:
Hi,
I have a perl-script to modify the system-time of my laptop. While I was connected to my university's broadband, I could run this via cron once per day. Now I have only dial-up at my home, so really can't determine whether I will be online, when this script runs. I would pretty much modify the script e.g. just to avoid errors mailed to me, that first it should check that we are online (dialed-in) or not and do setting the time only in the first case. My first idea was to ping e.g. www.google.com or a similar always-on machine, but I didn't manage to interpret it.
Does anyone have a few-line home-baked idea for such a task and would share it with me?
You can always grep the output of ifconfig, to see if you have an address assigned by your ISP. However, what problems were you having with pinging google? That's a very easy test to do. -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
participants (7)
-
Carlos E. R.
-
Darryl Gregorash
-
James Knott
-
Joachim Schrod
-
Mike McMullin
-
pelibali
-
Per Jessen