How to ensure a Ubuntu 16 systemd unit waits for ntpd to sync before starting?Systemd dependencies and boot orderVMWare Server flakiness on Ubuntu 9.10Not able to setup juggernaut push notification server on ubuntuinit.d script worked OK on Ubuntu 10.10 but not on 11.10 despite LBS header correctionHow to load the environment variables at boot time before X11 on Ubuntu Precise?pure-ftpd setup of pure-authd on Ubuntu (debian)Ubuntu 16.04 & Elasticsearch 1.7 - Startup ErrorRedis Sentinel Systemd services failing to start on Ubuntu 16.04 and CentOS 7Configuring MySQL to Listen for Remote Connections on UbuntuI get this error “Active: failed ” from the Process: 9666 ExecStart=/etc/init.d/apache2 start (code=exited, status=2)?Disabling systemd messages that interfere with running BASH script

How badly should I try to prevent a user from XSSing themselves?

What exploit are these user agents trying to use?

How much of data wrangling is a data scientist's job?

What does it mean to describe someone as a butt steak?

How can I tell someone that I want to be his or her friend?

Assassin's bullet with mercury

Can I ask the recruiters in my resume to put the reason why I am rejected?

If human space travel is limited by the G force vulnerability, is there a way to counter G forces?

Can I make "comment-region" comment empty lines?

How to draw the figure with four pentagons?

Does a druid starting with a bow start with no arrows?

Neighboring nodes in the network

What to put in ESTA if staying in US for a few days before going on to Canada

In Romance of the Three Kingdoms why do people still use bamboo sticks when papers are already invented?

Why 'in' operator is throwing error instead of logging false with string literal

Fully-Firstable Anagram Sets

prove that the matrix A is diagonalizable

Increase size of symbol intercal when in superscript position

Has there ever been an airliner design involving reducing generator load by installing solar panels?

Anagram holiday

Is there a hemisphere-neutral way of specifying a season?

Reserved de-dupe rules

Did Shadowfax go to Valinor?

Is it possible to download Internet Explorer on my Mac running OS X El Capitan?



How to ensure a Ubuntu 16 systemd unit waits for ntpd to sync before starting?


Systemd dependencies and boot orderVMWare Server flakiness on Ubuntu 9.10Not able to setup juggernaut push notification server on ubuntuinit.d script worked OK on Ubuntu 10.10 but not on 11.10 despite LBS header correctionHow to load the environment variables at boot time before X11 on Ubuntu Precise?pure-ftpd setup of pure-authd on Ubuntu (debian)Ubuntu 16.04 & Elasticsearch 1.7 - Startup ErrorRedis Sentinel Systemd services failing to start on Ubuntu 16.04 and CentOS 7Configuring MySQL to Listen for Remote Connections on UbuntuI get this error “Active: failed ” from the Process: 9666 ExecStart=/etc/init.d/apache2 start (code=exited, status=2)?Disabling systemd messages that interfere with running BASH script






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















We have a service that starts at boot. We need to ensure it doesn't start until the system clock has been synchronized via ntp. The machines are using ntpd.



The machines are using ntpd and not systemd-timesyncd for doing timesync. Can someone let me know what pre-conditions I have to wait for in the unit file.



Below is the content of ntp.service



support@vrni-platform:/etc/init.d$ sudo systemctl cat ntp.service
# /run/systemd/generator.late/ntp.service
# Automatically generated by systemd-sysv-generator

[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/ntp
Description=LSB: Start NTP daemon
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target
After=network-online.target
After=remote-fs.target
After=systemd-journald-dev-log.socket
Wants=network-online.target

[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/etc/init.d/ntp start
ExecStop=/etc/init.d/ntp stop


Below is a sample unit file which needs ntp sync



[Unit]
Description=Zookeeper Service
After=network-online.target
Wants=network-online.target

[Service]

Type=simple
ExecStartPre=-/bin/mkdir -p /var/log/zookeeper
ExecStartPre=-/bin/chown zookeeper /var/log/zookeeper
ExecStartPre=-/bin/mkdir -p /var/run/zookeeper
ExecStartPre=-/bin/chown zookeeper:zookeeper /var/run/zookeeper


ExecStartPre=-/bin/bash /usr/bin/zookeeper-systemd-prestart.sh
ExecStartPre=-/bin/su zookeeper -s /bin/bash -c '/usr/bin/zookeeper-server start'
ExecStartPre=-/bin/sleep 3
ExecStart=/bin/bash /usr/bin/zookeeper-systemd-health.sh
ExecStopPost=-/bin/bash /usr/bin/zookeeper-systemd-poststop.sh


RestartSec=2s
Restart=always


LimitNOFILE=65535

[Install]
WantedBy=multi-user.target









share|improve this question
























  • Possible duplicate of Systemd dependencies and boot order

    – HBruijn
    2 days ago











  • I don't think this is a duplicate question. I have edited my question.

    – tuk
    2 days ago

















1















We have a service that starts at boot. We need to ensure it doesn't start until the system clock has been synchronized via ntp. The machines are using ntpd.



The machines are using ntpd and not systemd-timesyncd for doing timesync. Can someone let me know what pre-conditions I have to wait for in the unit file.



Below is the content of ntp.service



support@vrni-platform:/etc/init.d$ sudo systemctl cat ntp.service
# /run/systemd/generator.late/ntp.service
# Automatically generated by systemd-sysv-generator

[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/ntp
Description=LSB: Start NTP daemon
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target
After=network-online.target
After=remote-fs.target
After=systemd-journald-dev-log.socket
Wants=network-online.target

[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/etc/init.d/ntp start
ExecStop=/etc/init.d/ntp stop


Below is a sample unit file which needs ntp sync



[Unit]
Description=Zookeeper Service
After=network-online.target
Wants=network-online.target

[Service]

Type=simple
ExecStartPre=-/bin/mkdir -p /var/log/zookeeper
ExecStartPre=-/bin/chown zookeeper /var/log/zookeeper
ExecStartPre=-/bin/mkdir -p /var/run/zookeeper
ExecStartPre=-/bin/chown zookeeper:zookeeper /var/run/zookeeper


ExecStartPre=-/bin/bash /usr/bin/zookeeper-systemd-prestart.sh
ExecStartPre=-/bin/su zookeeper -s /bin/bash -c '/usr/bin/zookeeper-server start'
ExecStartPre=-/bin/sleep 3
ExecStart=/bin/bash /usr/bin/zookeeper-systemd-health.sh
ExecStopPost=-/bin/bash /usr/bin/zookeeper-systemd-poststop.sh


RestartSec=2s
Restart=always


LimitNOFILE=65535

[Install]
WantedBy=multi-user.target









share|improve this question
























  • Possible duplicate of Systemd dependencies and boot order

    – HBruijn
    2 days ago











  • I don't think this is a duplicate question. I have edited my question.

    – tuk
    2 days ago













1












1








1








We have a service that starts at boot. We need to ensure it doesn't start until the system clock has been synchronized via ntp. The machines are using ntpd.



The machines are using ntpd and not systemd-timesyncd for doing timesync. Can someone let me know what pre-conditions I have to wait for in the unit file.



Below is the content of ntp.service



support@vrni-platform:/etc/init.d$ sudo systemctl cat ntp.service
# /run/systemd/generator.late/ntp.service
# Automatically generated by systemd-sysv-generator

[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/ntp
Description=LSB: Start NTP daemon
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target
After=network-online.target
After=remote-fs.target
After=systemd-journald-dev-log.socket
Wants=network-online.target

[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/etc/init.d/ntp start
ExecStop=/etc/init.d/ntp stop


Below is a sample unit file which needs ntp sync



[Unit]
Description=Zookeeper Service
After=network-online.target
Wants=network-online.target

[Service]

Type=simple
ExecStartPre=-/bin/mkdir -p /var/log/zookeeper
ExecStartPre=-/bin/chown zookeeper /var/log/zookeeper
ExecStartPre=-/bin/mkdir -p /var/run/zookeeper
ExecStartPre=-/bin/chown zookeeper:zookeeper /var/run/zookeeper


ExecStartPre=-/bin/bash /usr/bin/zookeeper-systemd-prestart.sh
ExecStartPre=-/bin/su zookeeper -s /bin/bash -c '/usr/bin/zookeeper-server start'
ExecStartPre=-/bin/sleep 3
ExecStart=/bin/bash /usr/bin/zookeeper-systemd-health.sh
ExecStopPost=-/bin/bash /usr/bin/zookeeper-systemd-poststop.sh


RestartSec=2s
Restart=always


LimitNOFILE=65535

[Install]
WantedBy=multi-user.target









share|improve this question
















We have a service that starts at boot. We need to ensure it doesn't start until the system clock has been synchronized via ntp. The machines are using ntpd.



The machines are using ntpd and not systemd-timesyncd for doing timesync. Can someone let me know what pre-conditions I have to wait for in the unit file.



Below is the content of ntp.service



support@vrni-platform:/etc/init.d$ sudo systemctl cat ntp.service
# /run/systemd/generator.late/ntp.service
# Automatically generated by systemd-sysv-generator

[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/ntp
Description=LSB: Start NTP daemon
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target
After=network-online.target
After=remote-fs.target
After=systemd-journald-dev-log.socket
Wants=network-online.target

[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/etc/init.d/ntp start
ExecStop=/etc/init.d/ntp stop


Below is a sample unit file which needs ntp sync



[Unit]
Description=Zookeeper Service
After=network-online.target
Wants=network-online.target

[Service]

Type=simple
ExecStartPre=-/bin/mkdir -p /var/log/zookeeper
ExecStartPre=-/bin/chown zookeeper /var/log/zookeeper
ExecStartPre=-/bin/mkdir -p /var/run/zookeeper
ExecStartPre=-/bin/chown zookeeper:zookeeper /var/run/zookeeper


ExecStartPre=-/bin/bash /usr/bin/zookeeper-systemd-prestart.sh
ExecStartPre=-/bin/su zookeeper -s /bin/bash -c '/usr/bin/zookeeper-server start'
ExecStartPre=-/bin/sleep 3
ExecStart=/bin/bash /usr/bin/zookeeper-systemd-health.sh
ExecStopPost=-/bin/bash /usr/bin/zookeeper-systemd-poststop.sh


RestartSec=2s
Restart=always


LimitNOFILE=65535

[Install]
WantedBy=multi-user.target






ubuntu ubuntu-16.04






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago







tuk

















asked 2 days ago









tuktuk

16618




16618












  • Possible duplicate of Systemd dependencies and boot order

    – HBruijn
    2 days ago











  • I don't think this is a duplicate question. I have edited my question.

    – tuk
    2 days ago

















  • Possible duplicate of Systemd dependencies and boot order

    – HBruijn
    2 days ago











  • I don't think this is a duplicate question. I have edited my question.

    – tuk
    2 days ago
















Possible duplicate of Systemd dependencies and boot order

– HBruijn
2 days ago





Possible duplicate of Systemd dependencies and boot order

– HBruijn
2 days ago













I don't think this is a duplicate question. I have edited my question.

– tuk
2 days ago





I don't think this is a duplicate question. I have edited my question.

– tuk
2 days ago










0






active

oldest

votes












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f961050%2fhow-to-ensure-a-ubuntu-16-systemd-unit-waits-for-ntpd-to-sync-before-starting%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Server Fault!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f961050%2fhow-to-ensure-a-ubuntu-16-systemd-unit-waits-for-ntpd-to-sync-before-starting%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

Why did Thanos need his ship to help him in the battle scene?Which actor plays Thanos in the Avengers mid-credits scene?Are there economic implications portrayed in comics where the buildings and cities are ruined almost daily?Old X-Men comic where team travels to alien world with a ring-like sun that needs recharging?Why does Ego need help sleeping?Is there an objective answer to who “the strongest Avenger” is?How did Banner get unstuck?Why did Thanos get hit?How did Thanos (or anyone) know the Infinity Stones would give him this power?Did Thanos leave Eitri alive for his after-sales service?In Avengers 1, why does Thanos need Loki?