[oO-en] Restarting ntpd on return from hibernation.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I want to restart ntpd on return from hibernation. Main reason is to make sure that the pool of servers is correct (can be days later than the previous time), and to ensure correct time, not knowing what ntpd does on hibernation (nothing is logged, so it probably does nothing). So I wonder what is the correct way of achieving this. I'm doing it via a script in "/etc/pm/sleep.d/07time": +++······················· !/bin/bash . /usr/lib/pm-utils/functions . /root/ThingsNeededForBoot/MyScriptDefinitions DATE=`date --rfc-3339=seconds` case "$1" in thaw|resume) $LOGGER -t pm-utils -p daemon.notice "restarting remote clock syncing after hibernating/suspend." systemctl restart ntpd.service ;; *) ;; esac exit $? ·······················++- It works. But I wonder if there is a better way using systemd "somehow". - -- Cheers Carlos E. R. (from 15.4 x86_64 at Telcontar) -----BEGIN PGP SIGNATURE----- iHYEARECADYWIQQZEb51mJKK1KpcU/W1MxgcbY1H1QUCY78iPhgcY2FybG9zLmUu ckBvcGVuc3VzZS5vcmcACgkQtTMYHG2NR9Vz3gCdEbmrJaAYsluBLdTc6WbkxVy/ nsQAn1RUTUx1b83Ihb6il0frpCAPQ7l/ =YAY8 -----END PGP SIGNATURE-----
Hello, In the Message; Subject : [oO-en] Restarting ntpd on return from hibernation. Message-ID : <50570aad-5c3d-2e57-c696-0f0eb53e4e29@opensuse.org> Date & Time: Wed, 11 Jan 2023 21:55:26 +0100 (CET) [CER] == "Carlos E. R." <carlos.e.r@opensuse.org> has written: CER> Hi, CER> I want to restart ntpd on return from hibernation. Main reason is to make sure CER> that the pool of servers is correct (can be days later than the CER> previous time), and to ensure correct time, not knowing what ntpd does on CER> hibernation (nothing is logged, so it probably does nothing). CER> So I wonder what is the correct way of achieving this. CER> I'm doing it via a script in "/etc/pm/sleep.d/07time": [...] CER> But I wonder if there is a better way using systemd "somehow". Please install ntp. Regards. --- ┏━━┓彡 野宮 賢 mail-to: m.nomiya+suse @ gmail.com ┃\/彡 ┗━━┛ "A bachelor’s degree still holds prestige as a ticket to the middle class, but its value has received increasing scrutiny. In the last several years, rising tuition and student loan debt have led more Americans to reconsider an investment in postsecondary education." -- Washington Post --
On 2023-01-12 02:14, Masaru Nomiya wrote:
Hello,
In the Message;
Subject : [oO-en] Restarting ntpd on return from hibernation. Message-ID : <50570aad-5c3d-2e57-c696-0f0eb53e4e29@opensuse.org> Date & Time: Wed, 11 Jan 2023 21:55:26 +0100 (CET)
[CER] == "Carlos E. R." <> has written:
CER> Hi,
CER> I want to restart ntpd on return from hibernation. Main reason is to make sure CER> that the pool of servers is correct (can be days later than the CER> previous time), and to ensure correct time, not knowing what ntpd does on CER> hibernation (nothing is logged, so it probably does nothing).
CER> So I wonder what is the correct way of achieving this.
CER> I'm doing it via a script in "/etc/pm/sleep.d/07time": [...] CER> But I wonder if there is a better way using systemd "somehow".
Please install ntp.
ntp is installed in my machine since decades. -- Cheers / Saludos, Carlos E. R. (from 15.4 x86_64 at Telcontar)
Hello, In the Message; Subject : Re: [oO-en] Restarting ntpd on return from hibernation. Message-ID : <e357a9b7-230a-27f8-fa79-55f708d30f6d@telefonica.net> Date & Time: Thu, 12 Jan 2023 11:20:34 +0100 [CER] == "Carlos E. R." <robin.listas@telefonica.net> has written: [...] CER>>> But I wonder if there is a better way using systemd "somehow". MN>> Please install ntp. CER> ntp is installed in my machine since decades. If that's the case, then what you say is a contradiction in terms. If it's installed, why not just do this? # systemctl restart ntpd First of all, you're using some kind of magic to say it's been installed for decades? I can't remember when opsnSUE started defaulting to not having ntp installed. Regards & Good Night. --- ┏━━┓彡 野宮 賢 mail-to: m.nomiya+suse @ gmail.com ┃\/彡 ┗━━┛ " Today’s China is not the old China humiliated and bullied over 100 years ago. It is time for these people to wake up from their imperial dream." -- Hua Chunying’s Regular Press Conference on August 4, 2022 --
On 2023-01-12 11:38, Masaru Nomiya wrote:
Hello,
In the Message;
Subject : Re: [oO-en] Restarting ntpd on return from hibernation. Message-ID : <e357a9b7-230a-27f8-fa79-55f708d30f6d@telefonica.net> Date & Time: Thu, 12 Jan 2023 11:20:34 +0100
[CER] == "Carlos E. R." <> has written:
[...] CER>>> But I wonder if there is a better way using systemd "somehow".
MN>> Please install ntp.
CER> ntp is installed in my machine since decades.
If that's the case, then what you say is a contradiction in terms.
If it's installed, why not just do this?
# systemctl restart ntpd
First of all, you're using some kind of magic to say it's been installed for decades?
There must be a translation issue here. My problem is *restarting automatically* ntpd service when machine returns from hibernation. See my recent post. -- Cheers / Saludos, Carlos E. R. (from 15.4 x86_64 at Telcontar)
Hello, I watched it after taking a bath, and I have mail. In the Message; Subject : Re: [oO-en] Restarting ntpd on return from hibernation. Message-ID : <476bcc98-2d64-7783-246f-3e69ae102801@telefonica.net> Date & Time: Thu, 12 Jan 2023 12:11:09 +0100 [CER] == "Carlos E. R." <robin.listas@telefonica.net> has written: [...] CER> > If that's the case, then what you say is a contradiction in terms. CER> > CER> > If it's installed, why not just do this? CER> > CER> > # systemctl restart ntpd CER> > CER> > First of all, you're using some kind of magic to say it's been CER> > installed for decades? CER> There must be a translation issue here. CER> My problem is *restarting automatically* ntpd service when CER> machine returns from hibernation. See my recent post. I know, I know... I wondered why you insisted on ntpd, so I told you to install ntp. That is, openSUSE uses chrony to synchronize the time, so ntp is excluded from the default installation. Since chroy has many advantages over nptd, it makes sense for openSUSE to use it. But you say ntp has been installed for decades, but what media did you install it on? It's a unbelievable mystery! Regards & Good Night. --- ┏━━┓彡 野宮 賢 mail-to: nomiya @ galaxy.dti.ne.jp ┃\/彡 ┗━━┛ "The question of who holds the platform and whether the person or organisation holding it is trustworthy has serious and profound implications in these volatile times. Once trust is broken, it is extremely difficult to restore. It is necessary to diversify in advance." -- Financial Times --
On 2023-01-12 12:55, Masaru Nomiya wrote:
Hello,
I watched it after taking a bath, and I have mail.
In the Message;
Subject : Re: [oO-en] Restarting ntpd on return from hibernation. Message-ID : <476bcc98-2d64-7783-246f-3e69ae102801@telefonica.net> Date & Time: Thu, 12 Jan 2023 12:11:09 +0100
[CER] == "Carlos E. R." <robin.listas@telefonica.net> has written:
[...] CER> > If that's the case, then what you say is a contradiction in terms. CER> > CER> > If it's installed, why not just do this? CER> > CER> > # systemctl restart ntpd CER> > CER> > First of all, you're using some kind of magic to say it's been CER> > installed for decades?
CER> There must be a translation issue here.
CER> My problem is *restarting automatically* ntpd service when CER> machine returns from hibernation. See my recent post.
I know, I know...
I wondered why you insisted on ntpd, so I told you to install ntp.
That is, openSUSE uses chrony to synchronize the time, so ntp is excluded from the default installation.
Since chroy has many advantages over nptd, it makes sense for openSUSE to use it.
But you say ntp has been installed for decades, but what media did you install it on?
It's a unbelievable mystery!
No mystery. My system started life with SuSE Linux 6.1, I think, around 1998. It has been upgraded (boot DVD, choose upgrade, or "zypper dup") over many versions since them. The hardware has also been upgraded more than once. Including an upgrade from 32 to 64 bits. Back then, at some point, I installed and configured ntpd, and thus, this system has it installed and running since decades (of course, not continuously). It was the only time service available, and I see no reason to change. It just works. Don't touch things that work. The only issue I have is that I want the service to be automatically restarted when the machine returns from hibernation, and the solution is to create the script "/usr/lib/systemd/system-sleep/mine-time". Previously I used a script in /etc/pm/sleep.d/90clock, which had stopped working at some point. -- Cheers / Saludos, Carlos E. R. (from 15.4 x86_64 at Telcontar)
Hello, In the Message; Subject : Re: [oO-en] Restarting ntpd on return from hibernation. Message-ID : <ba019426-8276-4b1d-dfbc-a91875031778@telefonica.net> Date & Time: Thu, 12 Jan 2023 13:56:25 +0100 [CER] == "Carlos E. R." <robin.listas@telefonica.net> has written: [...] MN> > But you say ntp has been installed for decades, but what media did you MN> > install it on? MN> > It's a unbelievable mystery! CER> No mystery. CER> My system started life with SuSE Linux 6.1, I think, around CER> 1998. It has been upgraded (boot DVD, choose upgrade, or "zypper CER> dup") over many versions since them. The hardware has also been CER> upgraded more than once. Including an upgrade from 32 to 64 bits. Unexpected! From your previous emails, I thought you were a clean installer. CER> Back then, at some point, I installed and configured ntpd, and CER> thus, this system has it installed and running since decades (of CER> course, not continuously). It was the only time service CER> available, and I see no reason to change. It just works. I see. By the way, even with your kind of upgarde method, does ntp get updated to the new system at the same time? The installer prioritizes system-specific stuff. So someday you had got the message, "I want to remove ntp because I want to install chrony.", had you? CER> Don't touch things that work. I know this is an ironclad rule of computer use, but that's why you don't switch to chrony. I would suggest you consider chrony. CER> The only issue I have is that I want the service to be CER> automatically restarted when the machine returns from CER> hibernation, and the solution is to create the script CER> "/usr/lib/systemd/system-sleep/mine-time". Previously I used a CER> script in /etc/pm/sleep.d/90clock, which had stopped working at CER> some point. I agree, this is a bit weird. If the problem is still the same with chrony, why don't you file a bug report? Regards. --- ┏━━┓彡 野宮 賢 mail-to: m.nomiya+suse @ gmail.com ┃\/彡 ┗━━┛ "Bill! You married with Computer. Not with Me!" "No..., with money."
On 2023-01-13 01:37, Masaru Nomiya wrote:
Hello,
In the Message;
Subject : Re: [oO-en] Restarting ntpd on return from hibernation. Message-ID : <ba019426-8276-4b1d-dfbc-a91875031778@telefonica.net> Date & Time: Thu, 12 Jan 2023 13:56:25 +0100
[CER] == "Carlos E. R." <robin.listas@telefonica.net> has written:
[...] MN> > But you say ntp has been installed for decades, but what media did you MN> > install it on?
MN> > It's a unbelievable mystery!
CER> No mystery.
CER> My system started life with SuSE Linux 6.1, I think, around CER> 1998. It has been upgraded (boot DVD, choose upgrade, or "zypper CER> dup") over many versions since them. The hardware has also been CER> upgraded more than once. Including an upgrade from 32 to 64 bits.
Unexpected!
From your previous emails, I thought you were a clean installer.
Only on new computers :-)
CER> Back then, at some point, I installed and configured ntpd, and CER> thus, this system has it installed and running since decades (of CER> course, not continuously). It was the only time service CER> available, and I see no reason to change. It just works.
I see.
By the way, even with your kind of upgarde method, does ntp get updated to the new system at the same time?
Certainly.
The installer prioritizes system-specific stuff. So someday you had got the message, "I want to remove ntp because I want to install chrony.", had you?
CER> Don't touch things that work.
I know this is an ironclad rule of computer use, but that's why you don't switch to chrony.
I would suggest you consider chrony.
I have no reason to.
CER> The only issue I have is that I want the service to be CER> automatically restarted when the machine returns from CER> hibernation, and the solution is to create the script CER> "/usr/lib/systemd/system-sleep/mine-time". Previously I used a CER> script in /etc/pm/sleep.d/90clock, which had stopped working at CER> some point.
I agree, this is a bit weird.
No. "pm" has been superseded, I just needed to migrate the hook script from pm to systemd. That is done and things are working again.
If the problem is still the same with chrony, why don't you file a bug report?
The problem is solved. I have two laptops which may or not be using ntpd, I don't remember. One of them doesn't boot at the moment. Eventually, I'll check them. -- Cheers / Saludos, Carlos E. R. (from 15.4 x86_64 at Telcontar)
On 2023-01-12 05:33, Robert Webb wrote:
On Wed, 11 Jan 2023 21:55:26 +0100 (CET), "Carlos E. R." <carlos.e.r@opensuse.org> wrote:
[...] I'm doing it via a script in "/etc/pm/sleep.d/07time":
+++······················· !/bin/bash
[...]
No hash ('#') character. Great that it works anyway. :-)
Oh, I wish that was the error... No, that was a mouse paste error, the original has the hash. This morning it did not work. And possibly other scripts in that directory are not working. Some seem to work. Telcontar:/etc/pm/sleep.d # ls -l total 52 -rwxr-xr-x 1 root root 1660 Nov 5 2019 04cosas yes -rwxr-xr-x 1 root root 628 Jul 14 2016 05inhibit -rwxr-xr-x 1 root root 776 Jul 14 2016 05nfscheck -rwxr-xr-x 1 root root 882 Jul 15 2016 05vmwarecheck -rwxr-xr-x 1 root root 1096 Jul 16 2016 06news no -rwxr-xr-x 1 root root 903 Apr 25 2014 06news~ -rwxr-xr-x 1 root root 439 Jan 11 22:08 07time no -rwxr-xr-x 1 root root 390 Jan 11 22:07 07time~ -rwxr-xr-x 1 root root 383 Jul 15 2016 20screensaver -rwxr-xr-x 1 root root 1495 Jul 15 2014 90clock ??? -rwxr-xr-x 1 root root 1679 Apr 27 2014 95cosas no -rw-r--r-- 1 root root 448 Aug 20 2012 99NOWAY -rw-r--r-- 1 root root 1608 Apr 27 2014 notas Telcontar:/etc/pm/sleep.d # The script "clock" attempted the same thing as "time", but is several years old, and doesn't run or work. Ah! 04cosas is not running. Instead something named "systemd-sleep" is running, just that it logs the same string. Telcontar:~ # l /usr/lib/systemd/system-sleep total 24 drwxr-xr-x 2 root root 4096 Dec 13 12:40 ./ drwxr-xr-x 22 root root 4096 Dec 29 21:05 ../ -rwxr-xr-x 1 root root 8073 Nov 15 10:26 grub2.sleep* -rwxr-xr-x 1 root root 1629 Mar 18 2020 mine-sleep* <=== -rwxr-xr-x 1 root root 662 May 18 2022 nut.sh* Telcontar:~ # Trying: /usr/lib/systemd/system-sleep/mine-time: #!/bin/bash . /usr/lib/pm-utils/functions . /root/ThingsNeededForBoot/MyScriptDefinitions DATE=`date --rfc-3339=seconds` case $1 in post) case $2 in thaw|resume) echo "$DATE Thawing/resuming." >> /var/log/ntp $LOGGER -t pm-utils -p daemon.notice "Restarting remote clock syncing after hibernating/suspend." systemctl restart ntpd.service ;; esac ;; esac No documentation. Telcontar:~ # apropos system-sleep system-sleep: nothing appropriate. Telcontar:~ # Ah. The directory is system-sleep, but the feature is systemd-sleep: Telcontar:~ # apropos systemd-sleep systemd-sleep (8) - System sleep state logic systemd-sleep.conf (5) - Suspend and hibernation configuration file Telcontar:~ # «Note that scripts or binaries dropped in /usr/lib/systemd/system-sleep/ are intended for local use only and should be considered hacks. If applications want to react to system suspend/hibernation and resume, they should rather use the Inhibitor interface[1].» So I do not see documentation for that directory. Will see how/if it works. -- Cheers / Saludos, Carlos E. R. (from 15.4 x86_64 at Telcontar)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday, 2023-01-12 at 12:08 +0100, Carlos E. R. wrote:
On 2023-01-12 05:33, Robert Webb wrote:
On Wed, 11 Jan 2023 21:55:26 +0100 (CET), "Carlos E. R." <> wrote:
Trying:
/usr/lib/systemd/system-sleep/mine-time:
#!/bin/bash
. /usr/lib/pm-utils/functions . /root/ThingsNeededForBoot/MyScriptDefinitions
DATE=`date --rfc-3339=seconds`
case $1 in post) case $2 in thaw|resume) echo "$DATE Thawing/resuming." >> /var/log/ntp $LOGGER -t pm-utils -p daemon.notice "Restarting remote clock syncing after hibernating/suspend." systemctl restart ntpd.service ;; esac ;; esac
...
Will see how/if it works.
Did not. It appears that "pre" is when hibernating or suspending, and "post" is recovery. Why have $1 and $2 with similar information I don't understand. I thought that "pre" meant early in the hibernation/recovery process (or previous), and "post" meant late or after. Not so. So now I have: !/bin/bash . /usr/lib/pm-utils/functions . /root/ThingsNeededForBoot/MyScriptDefinitions DATE=`date --rfc-3339=seconds` $LOGGER -t mine-sleep -p daemon.notice "Inside /usr/lib/systemd/system-sleep/mine-time. Params -$1--$2-." #<3.5> 2023-01-12T19:03:07.165222+01:00 Telcontar mine-sleep - - - Inside /usr/lib/systemd/system-sleep/mine-time. Params -pre--hibernate-. #<3.5> 2023-01-12T19:07:01.457919+01:00 Telcontar mine-sleep - - - Inside /usr/lib/systemd/system-sleep/mine-time. Params -post--hibernate-. # $1: "pre" is hibernating. "post" is recovering. case $1 in pre) echo "$DATE Thawing/resuming." >> /var/log/ntp $LOGGER -t mine-sleep -p daemon.notice "Restarting remote clock syncing after hibernating/suspend." systemctl restart ntpd.service ;; esac This does work, but is wrong, I should have "post". Mind fart. Correcting and testing: usr/lib/systemd/system-sleep/mine-time 789/789 100% #!/bin/bash . /usr/lib/pm-utils/functions . /root/ThingsNeededForBoot/MyScriptDefinitions DATE=`date --rfc-3339=seconds` $LOGGER -t mine-sleep -p daemon.notice "Inside /usr/lib/systemd/system-sleep/mine-time. Params -$1--$2-." #<3.5> 2023-01-12T19:03:07.165222+01:00 Telcontar mine-sleep - - - Inside /usr/lib/systemd/system-sleep/mine-time. Params -pre--hib #<3.5> 2023-01-12T19:07:01.457919+01:00 Telcontar mine-sleep - - - Inside /usr/lib/systemd/system-sleep/mine-time. Params -post--hi # $1: "pre" is hibernating. "post" is recovering. case $1 in post) echo "$DATE -- Thawing/resuming." >> /var/log/ntp $LOGGER -t mine-sleep -p daemon.notice "Restarting remote clock syncing after hibernating/suspend." systemctl restart ntpd.service ;; esac Produces this output: <3.6> 2023-01-12T19:27:22.411769+01:00 Telcontar systemd-sleep 10039 - - INFO: Running grub-once-restore .. <3.4> 2023-01-12T19:27:22.412871+01:00 Telcontar wickedd 1527 - - route ipv4 0.0.0.0/0 via 192.168.1.1 dev eth0#2 type unicast table main scope universe protocol boot covered by a ipv4:static lease <1.4> 2023-01-12T19:27:22.412945+01:00 Telcontar upowerd 4484 - - treating change event as add on /sys/devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-13 <1.4> 2023-01-12T19:27:22.413017+01:00 Telcontar upowerd 4484 - - treating change event as add on /sys/devices/pci0000:00/0000:00:01.3/0000:03:00.2/0000:20:08.0/0000:26:00.0/usb3/3-2 <1.4> 2023-01-12T19:27:22.415837+01:00 Telcontar upowerd 4484 - - treating change event as add on /sys/devices/pci0000:00/0000:00:08.1/0000:29:00.3/usb5/5-4 <1.4> 2023-01-12T19:27:22.420137+01:00 Telcontar upowerd 4484 - - treating change event as add on /sys/devices/pci0000:00/0000:00:08.1/0000:29:00.3/usb5/5-4 <3.5> 2023-01-12T19:27:22.458427+01:00 Telcontar mine-sleep - - - Inside /usr/lib/systemd/system-sleep/mine-time. Params -post--hibernate-. <3.4> 2023-01-12T19:27:22.463514+01:00 Telcontar mine-sleep - - - Thawing the system now (post)... <3.5> 2023-01-12T19:27:22.486791+01:00 Telcontar mine-sleep - - - Restarting remote clock syncing after hibernating/suspend. <3.6> 2023-01-12T19:27:22.496076+01:00 Telcontar systemd-sleep 10072 - - service: no such service upsd.service <3.6> 2023-01-12T19:27:22.520020+01:00 Telcontar systemd 1 - - Stopping NTP Server Daemon... <3.6> 2023-01-12T19:27:22.520892+01:00 Telcontar systemd 1 - - ntpd.service: Deactivated successfully. <3.6> 2023-01-12T19:27:22.521121+01:00 Telcontar systemd 1 - - Stopped NTP Server Daemon. <3.6> 2023-01-12T19:27:22.523389+01:00 Telcontar systemd 1 - - Starting NTP Server Daemon... <0.6> 2023-01-12T19:27:22.586745+01:00 Telcontar kernel - - - [697862.017339][T10032] sdf: sdf1 <3.6> 2023-01-12T19:27:22.618560+01:00 Telcontar systemd-sleep 10039 - - INFO: Done. <3.3> 2023-01-12T19:27:22.619066+01:00 Telcontar (sd-executor) 10037 - - /usr/lib/systemd/system-sleep/nut.sh failed with exit status 1. <1.6> 2023-01-12T19:27:22.713861+01:00 Telcontar sntp 10309 - - sntp 4.2.8p15@1.3728-o Tue Jun 15 12:00:00 UTC 2021 (1) <1.6> 2023-01-12T19:27:24.439507+01:00 Telcontar sntp 10309 - - 2023-01-12 19:27:22.715411 (+0100) +1.723994 +/- 1.191494 Isengard.valinor 192.168.1.16 s3 no-leap <3.6> 2023-01-12T19:27:24.440059+01:00 Telcontar start-ntpd 10302 - - Time synchronized with Isengard.valinor <3.5> 2023-01-12T19:27:24.535597+01:00 Telcontar ntpd 10324 - - ntpd 4.2.8p15@1.3728-o Tue Jun 15 12:00:00 UTC 2021 (1): Starting <3.5> 2023-01-12T19:27:24.535725+01:00 Telcontar ntpd 10324 - - Command line: /usr/sbin/ntpd -p /var/run/ntp/ntpd.pid -g -u ntp:ntp -i /var/lib/ntp -c /etc/ntp.conf <3.5> 2023-01-12T19:27:24.535784+01:00 Telcontar ntpd 10324 - - ---------------------------------------------------- <3.5> 2023-01-12T19:27:24.535825+01:00 Telcontar ntpd 10324 - - ntp-4 is maintained by Network Time Foundation, <3.5> 2023-01-12T19:27:24.535863+01:00 Telcontar ntpd 10324 - - Inc. (NTF), a non-profit 501(c)(3) public-benefit <3.5> 2023-01-12T19:27:24.535902+01:00 Telcontar ntpd 10324 - - corporation. Support and training for ntp-4 are <3.5> 2023-01-12T19:27:24.535951+01:00 Telcontar ntpd 10324 - - available at https://www.nwtime.org/support <3.5> 2023-01-12T19:27:24.536011+01:00 Telcontar ntpd 10324 - - ---------------------------------------------------- <3.6> 2023-01-12T19:27:24.536946+01:00 Telcontar ntpd 10326 - - proto: precision = 0.090 usec (-23) <3.6> 2023-01-12T19:27:24.537120+01:00 Telcontar ntpd 10326 - - basedate set to 2021-06-03 <3.6> 2023-01-12T19:27:24.537200+01:00 Telcontar ntpd 10326 - - gps base set to 2021-06-06 (week 2161) <3.5> 2023-01-12T19:27:24.537335+01:00 Telcontar ntpd 10326 - - switching logging to file /var/log/ntp <3.6> 2023-01-12T19:27:24.539516+01:00 Telcontar start-ntpd 10221 - - Starting network time protocol daemon (NTPD) <3.6> 2023-01-12T19:27:24.539678+01:00 Telcontar systemd 1 - - Started NTP Server Daemon. <3.6> 2023-01-12T19:27:24.541844+01:00 Telcontar systemd 1 - - systemd-hibernate.service: Deactivated successfully. Now everything seems correct. Only cosmetic adjustments needed. - -- Cheers, Carlos E. R. (from openSUSE 15.4 x86_64 at Telcontar) -----BEGIN PGP SIGNATURE----- iHoEARECADoWIQQZEb51mJKK1KpcU/W1MxgcbY1H1QUCY8BStRwccm9iaW4ubGlz dGFzQHRlbGVmb25pY2EubmV0AAoJELUzGBxtjUfVvksAnRhKE778NZRmE83eDTI2 35GGPPaVAJ9cCZpr9QEHcm7bOF/95z8yZF7Wdw== =edaS -----END PGP SIGNATURE-----
Carlos, et al -- ...and then Carlos E. R. said... % ... % % Did not. It appears that "pre" is when hibernating or suspending, and "post" % is recovery. Why have $1 and $2 with similar information I don't understand. % I thought that "pre" meant early in the hibernation/recovery process (or % previous), and "post" meant late or after. Not so. [snip] I know this has been a while, but I wanted to circle back to this now that I have a moment ... Different states ("sleep"/"suspend" vs "hibernate") may have different requirements upon "waking", so it would be useful to know how the laptop went down as it's coming up. HTH & QTBD :-D -- David T-G See http://justpickone.org/davidtg/email/ See http://justpickone.org/davidtg/tofu.txt
On 2023-01-16 14:26, David T-G wrote:
Carlos, et al --
...and then Carlos E. R. said... % ... % % Did not. It appears that "pre" is when hibernating or suspending, and "post" % is recovery. Why have $1 and $2 with similar information I don't understand. % I thought that "pre" meant early in the hibernation/recovery process (or % previous), and "post" meant late or after. Not so. [snip]
I know this has been a while, but I wanted to circle back to this now that I have a moment ... Different states ("sleep"/"suspend" vs "hibernate") may have different requirements upon "waking", so it would be useful to know how the laptop went down as it's coming up.
Of course, but you only need a list of states: case $state of sleep hybrid-sleep hybernate resume thawing Pre and post are superfluous. pm-utils did not use them. -- Cheers / Saludos, Carlos E. R. (from 15.4 x86_64 at Telcontar)
Carlos E. R. wrote:
I want to restart ntpd on return from hibernation. Main reason is to make sure that the pool of servers is correct (can be days later than the previous time), and to ensure correct time, not knowing what ntpd does on hibernation (nothing is logged, so it probably does nothing).
So I wonder what is the correct way of achieving this.
The following works for me: ---------------------- # /etc/systemd/system/kkk999.service # ExecStart is executed on wake up from 'sleep' (suspend or hibernate). [Install] WantedBy=sleep.target [Unit] Description=kkk999 After=systemd-suspend.service systemd-hybrid-sleep.service systemd-hibernate.service [Service] Type=simple ExecStart=/usr/bin/systemctl restart ntpd ----------------------------- Not thoroughly tested and not tested with ntpd. -- Per Jessen, Zürich (9.8°C) Member, openSUSE Heroes (2016 - present) We're hiring - https://en.opensuse.org/openSUSE:Heroes
On 2023-01-14 18:07, Per Jessen wrote:
Carlos E. R. wrote:
I want to restart ntpd on return from hibernation. Main reason is to make sure that the pool of servers is correct (can be days later than the previous time), and to ensure correct time, not knowing what ntpd does on hibernation (nothing is logged, so it probably does nothing).
So I wonder what is the correct way of achieving this.
The following works for me:
---------------------- # /etc/systemd/system/kkk999.service # ExecStart is executed on wake up from 'sleep' (suspend or hibernate). [Install] WantedBy=sleep.target
[Unit] Description=kkk999 After=systemd-suspend.service systemd-hybrid-sleep.service systemd-hibernate.service
[Service] Type=simple ExecStart=/usr/bin/systemctl restart ntpd -----------------------------
Not thoroughly tested and not tested with ntpd.
Thanks, noted. Will try, time permitting, when I recover myself from the router problem. Has been an hectic 30 hours. Just had "Spanish midday" lunch at 17:45 hours. -- Cheers / Saludos, Carlos E. R. (from 15.4 x86_64 at Telcontar)
participants (6)
-
Carlos E. R.
-
Carlos E. R.
-
David T-G
-
Masaru Nomiya
-
Per Jessen
-
Robert Webb