Ubuntu 16 - How to make Systemd keep on trying to start service even when start condition failed?
I have a sytemd unit file for kafka like below.
[Unit]
Description=Apache Kafka server (broker)
Documentation=http://kafka.apache.org/documentation.html
Requires=network.target remote-fs.target
After=network.target remote-fs.target kafka-zookeeper.service
[Service]
Type=simple
User=nano
Group=nano
Environment=JAVA_HOME=/usr/java/jdk1.8.0_102
ExecStart=/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties
ExecStop=/opt/kafka/bin/kafka-server-stop.sh
RestartSec=2s
Restart=always
[Install]
WantedBy=multi-user.target
Zookeeper unit file.
[Service]
Type=simple
User=nano
Group=nano
Environment=JAVA_HOME=/usr/java/jdk1.8.0_102
ExecStart=/opt/kafka/bin/zookeeper-server-start.sh /opt/kafka/config/zookeeper.properties
ExecStop=/opt/kafka/bin/zookeeper-server-stop.sh
RestartSec=2s
Restart=always
Sometimes I am observing that kafka is in a stopped state and doing systemctl status kafka.service
showing me the below message
ubuntu@platform3:/usr/lib/systemd/system$ sudo systemctl status kafka.service
● kafka.service - Kafka Service
Loaded: loaded (/usr/lib/systemd/system/kafka.service; enabled; vendor preset: enabled)
Active: inactive (dead)
Condition: start condition failed at Mon 2019-03-25 17:56:30 UTC; 10h ago
On checking logs it seems when sudo systemctl start kafka.service
was executed that time zookeeper was not running . So the pre-condition did not meet and kafka did not start.
But after sometime zookeeper was up and running but even then Kafka did not start. Can someone let me know if there is a way I can make systemd keep on trying to start kafka and not just stop once if pre-conditions are not met like the way it is happening now?
16.04 systemd
add a comment |
I have a sytemd unit file for kafka like below.
[Unit]
Description=Apache Kafka server (broker)
Documentation=http://kafka.apache.org/documentation.html
Requires=network.target remote-fs.target
After=network.target remote-fs.target kafka-zookeeper.service
[Service]
Type=simple
User=nano
Group=nano
Environment=JAVA_HOME=/usr/java/jdk1.8.0_102
ExecStart=/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties
ExecStop=/opt/kafka/bin/kafka-server-stop.sh
RestartSec=2s
Restart=always
[Install]
WantedBy=multi-user.target
Zookeeper unit file.
[Service]
Type=simple
User=nano
Group=nano
Environment=JAVA_HOME=/usr/java/jdk1.8.0_102
ExecStart=/opt/kafka/bin/zookeeper-server-start.sh /opt/kafka/config/zookeeper.properties
ExecStop=/opt/kafka/bin/zookeeper-server-stop.sh
RestartSec=2s
Restart=always
Sometimes I am observing that kafka is in a stopped state and doing systemctl status kafka.service
showing me the below message
ubuntu@platform3:/usr/lib/systemd/system$ sudo systemctl status kafka.service
● kafka.service - Kafka Service
Loaded: loaded (/usr/lib/systemd/system/kafka.service; enabled; vendor preset: enabled)
Active: inactive (dead)
Condition: start condition failed at Mon 2019-03-25 17:56:30 UTC; 10h ago
On checking logs it seems when sudo systemctl start kafka.service
was executed that time zookeeper was not running . So the pre-condition did not meet and kafka did not start.
But after sometime zookeeper was up and running but even then Kafka did not start. Can someone let me know if there is a way I can make systemd keep on trying to start kafka and not just stop once if pre-conditions are not met like the way it is happening now?
16.04 systemd
add a comment |
I have a sytemd unit file for kafka like below.
[Unit]
Description=Apache Kafka server (broker)
Documentation=http://kafka.apache.org/documentation.html
Requires=network.target remote-fs.target
After=network.target remote-fs.target kafka-zookeeper.service
[Service]
Type=simple
User=nano
Group=nano
Environment=JAVA_HOME=/usr/java/jdk1.8.0_102
ExecStart=/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties
ExecStop=/opt/kafka/bin/kafka-server-stop.sh
RestartSec=2s
Restart=always
[Install]
WantedBy=multi-user.target
Zookeeper unit file.
[Service]
Type=simple
User=nano
Group=nano
Environment=JAVA_HOME=/usr/java/jdk1.8.0_102
ExecStart=/opt/kafka/bin/zookeeper-server-start.sh /opt/kafka/config/zookeeper.properties
ExecStop=/opt/kafka/bin/zookeeper-server-stop.sh
RestartSec=2s
Restart=always
Sometimes I am observing that kafka is in a stopped state and doing systemctl status kafka.service
showing me the below message
ubuntu@platform3:/usr/lib/systemd/system$ sudo systemctl status kafka.service
● kafka.service - Kafka Service
Loaded: loaded (/usr/lib/systemd/system/kafka.service; enabled; vendor preset: enabled)
Active: inactive (dead)
Condition: start condition failed at Mon 2019-03-25 17:56:30 UTC; 10h ago
On checking logs it seems when sudo systemctl start kafka.service
was executed that time zookeeper was not running . So the pre-condition did not meet and kafka did not start.
But after sometime zookeeper was up and running but even then Kafka did not start. Can someone let me know if there is a way I can make systemd keep on trying to start kafka and not just stop once if pre-conditions are not met like the way it is happening now?
16.04 systemd
I have a sytemd unit file for kafka like below.
[Unit]
Description=Apache Kafka server (broker)
Documentation=http://kafka.apache.org/documentation.html
Requires=network.target remote-fs.target
After=network.target remote-fs.target kafka-zookeeper.service
[Service]
Type=simple
User=nano
Group=nano
Environment=JAVA_HOME=/usr/java/jdk1.8.0_102
ExecStart=/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties
ExecStop=/opt/kafka/bin/kafka-server-stop.sh
RestartSec=2s
Restart=always
[Install]
WantedBy=multi-user.target
Zookeeper unit file.
[Service]
Type=simple
User=nano
Group=nano
Environment=JAVA_HOME=/usr/java/jdk1.8.0_102
ExecStart=/opt/kafka/bin/zookeeper-server-start.sh /opt/kafka/config/zookeeper.properties
ExecStop=/opt/kafka/bin/zookeeper-server-stop.sh
RestartSec=2s
Restart=always
Sometimes I am observing that kafka is in a stopped state and doing systemctl status kafka.service
showing me the below message
ubuntu@platform3:/usr/lib/systemd/system$ sudo systemctl status kafka.service
● kafka.service - Kafka Service
Loaded: loaded (/usr/lib/systemd/system/kafka.service; enabled; vendor preset: enabled)
Active: inactive (dead)
Condition: start condition failed at Mon 2019-03-25 17:56:30 UTC; 10h ago
On checking logs it seems when sudo systemctl start kafka.service
was executed that time zookeeper was not running . So the pre-condition did not meet and kafka did not start.
But after sometime zookeeper was up and running but even then Kafka did not start. Can someone let me know if there is a way I can make systemd keep on trying to start kafka and not just stop once if pre-conditions are not met like the way it is happening now?
16.04 systemd
16.04 systemd
asked 14 mins ago
tuktuk
1136
1136
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1128725%2fubuntu-16-how-to-make-systemd-keep-on-trying-to-start-service-even-when-start%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
Thanks for contributing an answer to Ask Ubuntu!
- 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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1128725%2fubuntu-16-how-to-make-systemd-keep-on-trying-to-start-service-even-when-start%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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