Systemd service fail when stop
My service /usr/lib/systemd/system/zookeeper.service are fail when I stop.
[vagrant@localhost ~]$ sudo systemctl stop zookeeper
[vagrant@localhost ~]$ sudo systemctl status zookeeper
● zookeeper.service - Zookeeper Distributed Coordination Server
Loaded: loaded (/usr/lib/systemd/system/zookeeper.service; enabled; vendor preset: disabled)
Active: failed (Result: signal) since Sat 2019-01-19 20:36:50 UTC; 1s ago
Docs: http://zookeeper.apache.org
Process: 10488 ExecStop=/opt/zookeeper/bin/zkServer.sh stop (code=exited, status=0/SUCCESS)
Process: 10439 ExecStart=/opt/zookeeper/bin/zkServer.sh start (code=exited, status=0/SUCCESS)
Main PID: 10448 (code=killed, signal=KILL)
Jan 19 20:36:42 localhost.localdomain zkServer.sh[10439]: ZooKeeper JMX enabled by default
Jan 19 20:36:42 localhost.localdomain zkServer.sh[10439]: Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Jan 19 20:36:43 localhost.localdomain systemd[1]: Started Zookeeper Distributed Coordination Server.
Jan 19 20:36:50 localhost.localdomain systemd[1]: Stopping Zookeeper Distributed Coordination Server...
Jan 19 20:36:50 localhost.localdomain zkServer.sh[10488]: ZooKeeper JMX enabled by default
Jan 19 20:36:50 localhost.localdomain zkServer.sh[10488]: Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Jan 19 20:36:50 localhost.localdomain systemd[1]: zookeeper.service: main process exited, code=killed, status=9/KILL
Jan 19 20:36:50 localhost.localdomain systemd[1]: Stopped Zookeeper Distributed Coordination Server.
Jan 19 20:36:50 localhost.localdomain systemd[1]: Unit zookeeper.service entered failed state.
Jan 19 20:36:50 localhost.localdomain systemd[1]: zookeeper.service failed.
The complete code of service:
[Unit]
Description=Zookeeper Distributed Coordination Server
Documentation=http://zookeeper.apache.org
After=network.target
Wants=network.target
[Service]
Type=forking
User=zookeeper
Group=zookeeper
WorkingDirectory=/opt/zookeeper
Environment=ZOO_LOG_DIR=/var/log/zookeeper
ExecStart=/opt/zookeeper/bin/zkServer.sh start
ExecStop=/opt/zookeeper/bin/zkServer.sh stop
Restart=on-failure
[Install]
WantedBy=multi-user.target
When start the service everything works:
[vagrant@localhost ~]$ sudo systemctl start zookeeper
[vagrant@localhost ~]$ sudo systemctl status zookeeper
● zookeeper.service - Zookeeper Distributed Coordination Server
Loaded: loaded (/usr/lib/systemd/system/zookeeper.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2019-01-19 20:38:29 UTC; 1s ago
Docs: http://zookeeper.apache.org
Process: 10488 ExecStop=/opt/zookeeper/bin/zkServer.sh stop (code=exited, status=0/SUCCESS)
Process: 10590 ExecStart=/opt/zookeeper/bin/zkServer.sh start (code=exited, status=0/SUCCESS)
Main PID: 10599 (java)
Tasks: 20
Memory: 35.1M
CGroup: /system.slice/zookeeper.service
└─10599 java -Dzookeeper.log.dir=/var/log/zookeeper -Dzookeeper.root.logger=INFO,CONSOLE -cp /opt/zookeeper/bin/../build/classes:/opt/zookeeper/bin/../build/lib/*.jar:/opt/zookeeper/bin/../l...
Jan 19 20:38:28 localhost.localdomain systemd[1]: Starting Zookeeper Distributed Coordination Server...
Jan 19 20:38:28 localhost.localdomain zkServer.sh[10590]: ZooKeeper JMX enabled by default
Jan 19 20:38:28 localhost.localdomain zkServer.sh[10590]: Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Jan 19 20:38:29 localhost.localdomain systemd[1]: Started Zookeeper Distributed Coordination Server.
systemd
add a comment |
My service /usr/lib/systemd/system/zookeeper.service are fail when I stop.
[vagrant@localhost ~]$ sudo systemctl stop zookeeper
[vagrant@localhost ~]$ sudo systemctl status zookeeper
● zookeeper.service - Zookeeper Distributed Coordination Server
Loaded: loaded (/usr/lib/systemd/system/zookeeper.service; enabled; vendor preset: disabled)
Active: failed (Result: signal) since Sat 2019-01-19 20:36:50 UTC; 1s ago
Docs: http://zookeeper.apache.org
Process: 10488 ExecStop=/opt/zookeeper/bin/zkServer.sh stop (code=exited, status=0/SUCCESS)
Process: 10439 ExecStart=/opt/zookeeper/bin/zkServer.sh start (code=exited, status=0/SUCCESS)
Main PID: 10448 (code=killed, signal=KILL)
Jan 19 20:36:42 localhost.localdomain zkServer.sh[10439]: ZooKeeper JMX enabled by default
Jan 19 20:36:42 localhost.localdomain zkServer.sh[10439]: Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Jan 19 20:36:43 localhost.localdomain systemd[1]: Started Zookeeper Distributed Coordination Server.
Jan 19 20:36:50 localhost.localdomain systemd[1]: Stopping Zookeeper Distributed Coordination Server...
Jan 19 20:36:50 localhost.localdomain zkServer.sh[10488]: ZooKeeper JMX enabled by default
Jan 19 20:36:50 localhost.localdomain zkServer.sh[10488]: Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Jan 19 20:36:50 localhost.localdomain systemd[1]: zookeeper.service: main process exited, code=killed, status=9/KILL
Jan 19 20:36:50 localhost.localdomain systemd[1]: Stopped Zookeeper Distributed Coordination Server.
Jan 19 20:36:50 localhost.localdomain systemd[1]: Unit zookeeper.service entered failed state.
Jan 19 20:36:50 localhost.localdomain systemd[1]: zookeeper.service failed.
The complete code of service:
[Unit]
Description=Zookeeper Distributed Coordination Server
Documentation=http://zookeeper.apache.org
After=network.target
Wants=network.target
[Service]
Type=forking
User=zookeeper
Group=zookeeper
WorkingDirectory=/opt/zookeeper
Environment=ZOO_LOG_DIR=/var/log/zookeeper
ExecStart=/opt/zookeeper/bin/zkServer.sh start
ExecStop=/opt/zookeeper/bin/zkServer.sh stop
Restart=on-failure
[Install]
WantedBy=multi-user.target
When start the service everything works:
[vagrant@localhost ~]$ sudo systemctl start zookeeper
[vagrant@localhost ~]$ sudo systemctl status zookeeper
● zookeeper.service - Zookeeper Distributed Coordination Server
Loaded: loaded (/usr/lib/systemd/system/zookeeper.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2019-01-19 20:38:29 UTC; 1s ago
Docs: http://zookeeper.apache.org
Process: 10488 ExecStop=/opt/zookeeper/bin/zkServer.sh stop (code=exited, status=0/SUCCESS)
Process: 10590 ExecStart=/opt/zookeeper/bin/zkServer.sh start (code=exited, status=0/SUCCESS)
Main PID: 10599 (java)
Tasks: 20
Memory: 35.1M
CGroup: /system.slice/zookeeper.service
└─10599 java -Dzookeeper.log.dir=/var/log/zookeeper -Dzookeeper.root.logger=INFO,CONSOLE -cp /opt/zookeeper/bin/../build/classes:/opt/zookeeper/bin/../build/lib/*.jar:/opt/zookeeper/bin/../l...
Jan 19 20:38:28 localhost.localdomain systemd[1]: Starting Zookeeper Distributed Coordination Server...
Jan 19 20:38:28 localhost.localdomain zkServer.sh[10590]: ZooKeeper JMX enabled by default
Jan 19 20:38:28 localhost.localdomain zkServer.sh[10590]: Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Jan 19 20:38:29 localhost.localdomain systemd[1]: Started Zookeeper Distributed Coordination Server.
systemd
add a comment |
My service /usr/lib/systemd/system/zookeeper.service are fail when I stop.
[vagrant@localhost ~]$ sudo systemctl stop zookeeper
[vagrant@localhost ~]$ sudo systemctl status zookeeper
● zookeeper.service - Zookeeper Distributed Coordination Server
Loaded: loaded (/usr/lib/systemd/system/zookeeper.service; enabled; vendor preset: disabled)
Active: failed (Result: signal) since Sat 2019-01-19 20:36:50 UTC; 1s ago
Docs: http://zookeeper.apache.org
Process: 10488 ExecStop=/opt/zookeeper/bin/zkServer.sh stop (code=exited, status=0/SUCCESS)
Process: 10439 ExecStart=/opt/zookeeper/bin/zkServer.sh start (code=exited, status=0/SUCCESS)
Main PID: 10448 (code=killed, signal=KILL)
Jan 19 20:36:42 localhost.localdomain zkServer.sh[10439]: ZooKeeper JMX enabled by default
Jan 19 20:36:42 localhost.localdomain zkServer.sh[10439]: Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Jan 19 20:36:43 localhost.localdomain systemd[1]: Started Zookeeper Distributed Coordination Server.
Jan 19 20:36:50 localhost.localdomain systemd[1]: Stopping Zookeeper Distributed Coordination Server...
Jan 19 20:36:50 localhost.localdomain zkServer.sh[10488]: ZooKeeper JMX enabled by default
Jan 19 20:36:50 localhost.localdomain zkServer.sh[10488]: Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Jan 19 20:36:50 localhost.localdomain systemd[1]: zookeeper.service: main process exited, code=killed, status=9/KILL
Jan 19 20:36:50 localhost.localdomain systemd[1]: Stopped Zookeeper Distributed Coordination Server.
Jan 19 20:36:50 localhost.localdomain systemd[1]: Unit zookeeper.service entered failed state.
Jan 19 20:36:50 localhost.localdomain systemd[1]: zookeeper.service failed.
The complete code of service:
[Unit]
Description=Zookeeper Distributed Coordination Server
Documentation=http://zookeeper.apache.org
After=network.target
Wants=network.target
[Service]
Type=forking
User=zookeeper
Group=zookeeper
WorkingDirectory=/opt/zookeeper
Environment=ZOO_LOG_DIR=/var/log/zookeeper
ExecStart=/opt/zookeeper/bin/zkServer.sh start
ExecStop=/opt/zookeeper/bin/zkServer.sh stop
Restart=on-failure
[Install]
WantedBy=multi-user.target
When start the service everything works:
[vagrant@localhost ~]$ sudo systemctl start zookeeper
[vagrant@localhost ~]$ sudo systemctl status zookeeper
● zookeeper.service - Zookeeper Distributed Coordination Server
Loaded: loaded (/usr/lib/systemd/system/zookeeper.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2019-01-19 20:38:29 UTC; 1s ago
Docs: http://zookeeper.apache.org
Process: 10488 ExecStop=/opt/zookeeper/bin/zkServer.sh stop (code=exited, status=0/SUCCESS)
Process: 10590 ExecStart=/opt/zookeeper/bin/zkServer.sh start (code=exited, status=0/SUCCESS)
Main PID: 10599 (java)
Tasks: 20
Memory: 35.1M
CGroup: /system.slice/zookeeper.service
└─10599 java -Dzookeeper.log.dir=/var/log/zookeeper -Dzookeeper.root.logger=INFO,CONSOLE -cp /opt/zookeeper/bin/../build/classes:/opt/zookeeper/bin/../build/lib/*.jar:/opt/zookeeper/bin/../l...
Jan 19 20:38:28 localhost.localdomain systemd[1]: Starting Zookeeper Distributed Coordination Server...
Jan 19 20:38:28 localhost.localdomain zkServer.sh[10590]: ZooKeeper JMX enabled by default
Jan 19 20:38:28 localhost.localdomain zkServer.sh[10590]: Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Jan 19 20:38:29 localhost.localdomain systemd[1]: Started Zookeeper Distributed Coordination Server.
systemd
My service /usr/lib/systemd/system/zookeeper.service are fail when I stop.
[vagrant@localhost ~]$ sudo systemctl stop zookeeper
[vagrant@localhost ~]$ sudo systemctl status zookeeper
● zookeeper.service - Zookeeper Distributed Coordination Server
Loaded: loaded (/usr/lib/systemd/system/zookeeper.service; enabled; vendor preset: disabled)
Active: failed (Result: signal) since Sat 2019-01-19 20:36:50 UTC; 1s ago
Docs: http://zookeeper.apache.org
Process: 10488 ExecStop=/opt/zookeeper/bin/zkServer.sh stop (code=exited, status=0/SUCCESS)
Process: 10439 ExecStart=/opt/zookeeper/bin/zkServer.sh start (code=exited, status=0/SUCCESS)
Main PID: 10448 (code=killed, signal=KILL)
Jan 19 20:36:42 localhost.localdomain zkServer.sh[10439]: ZooKeeper JMX enabled by default
Jan 19 20:36:42 localhost.localdomain zkServer.sh[10439]: Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Jan 19 20:36:43 localhost.localdomain systemd[1]: Started Zookeeper Distributed Coordination Server.
Jan 19 20:36:50 localhost.localdomain systemd[1]: Stopping Zookeeper Distributed Coordination Server...
Jan 19 20:36:50 localhost.localdomain zkServer.sh[10488]: ZooKeeper JMX enabled by default
Jan 19 20:36:50 localhost.localdomain zkServer.sh[10488]: Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Jan 19 20:36:50 localhost.localdomain systemd[1]: zookeeper.service: main process exited, code=killed, status=9/KILL
Jan 19 20:36:50 localhost.localdomain systemd[1]: Stopped Zookeeper Distributed Coordination Server.
Jan 19 20:36:50 localhost.localdomain systemd[1]: Unit zookeeper.service entered failed state.
Jan 19 20:36:50 localhost.localdomain systemd[1]: zookeeper.service failed.
The complete code of service:
[Unit]
Description=Zookeeper Distributed Coordination Server
Documentation=http://zookeeper.apache.org
After=network.target
Wants=network.target
[Service]
Type=forking
User=zookeeper
Group=zookeeper
WorkingDirectory=/opt/zookeeper
Environment=ZOO_LOG_DIR=/var/log/zookeeper
ExecStart=/opt/zookeeper/bin/zkServer.sh start
ExecStop=/opt/zookeeper/bin/zkServer.sh stop
Restart=on-failure
[Install]
WantedBy=multi-user.target
When start the service everything works:
[vagrant@localhost ~]$ sudo systemctl start zookeeper
[vagrant@localhost ~]$ sudo systemctl status zookeeper
● zookeeper.service - Zookeeper Distributed Coordination Server
Loaded: loaded (/usr/lib/systemd/system/zookeeper.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2019-01-19 20:38:29 UTC; 1s ago
Docs: http://zookeeper.apache.org
Process: 10488 ExecStop=/opt/zookeeper/bin/zkServer.sh stop (code=exited, status=0/SUCCESS)
Process: 10590 ExecStart=/opt/zookeeper/bin/zkServer.sh start (code=exited, status=0/SUCCESS)
Main PID: 10599 (java)
Tasks: 20
Memory: 35.1M
CGroup: /system.slice/zookeeper.service
└─10599 java -Dzookeeper.log.dir=/var/log/zookeeper -Dzookeeper.root.logger=INFO,CONSOLE -cp /opt/zookeeper/bin/../build/classes:/opt/zookeeper/bin/../build/lib/*.jar:/opt/zookeeper/bin/../l...
Jan 19 20:38:28 localhost.localdomain systemd[1]: Starting Zookeeper Distributed Coordination Server...
Jan 19 20:38:28 localhost.localdomain zkServer.sh[10590]: ZooKeeper JMX enabled by default
Jan 19 20:38:28 localhost.localdomain zkServer.sh[10590]: Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Jan 19 20:38:29 localhost.localdomain systemd[1]: Started Zookeeper Distributed Coordination Server.
systemd
systemd
asked Jan 19 at 20:43
Bruno WegoBruno Wego
2601316
2601316
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Change ExecStop to use /bin/kill and point PIDFile to the .pid file:
[Unit]
Description=Zookeeper Distributed Coordination Server
Documentation=http://zookeeper.apache.org
After=network.target
[Service]
Type=forking
User=zookeeper
Group=zookeeper
WorkingDirectory=/opt/zookeeper
Environment=ZOO_LOG_DIR=/var/log/zookeeper
ExecStart=/opt/zookeeper/bin/zkServer.sh start
PIDFile=/var/lib/zookeeper/zookeeper_server.pid
ExecStop=/bin/kill $MAINPID
SuccessExitStatus=1 143
Restart=on-failure
[Install]
WantedBy=multi-user.target
Don't forget change SuccessExitStatus to code 1 143.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
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%2fstackoverflow.com%2fquestions%2f54271230%2fsystemd-service-fail-when-stop%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Change ExecStop to use /bin/kill and point PIDFile to the .pid file:
[Unit]
Description=Zookeeper Distributed Coordination Server
Documentation=http://zookeeper.apache.org
After=network.target
[Service]
Type=forking
User=zookeeper
Group=zookeeper
WorkingDirectory=/opt/zookeeper
Environment=ZOO_LOG_DIR=/var/log/zookeeper
ExecStart=/opt/zookeeper/bin/zkServer.sh start
PIDFile=/var/lib/zookeeper/zookeeper_server.pid
ExecStop=/bin/kill $MAINPID
SuccessExitStatus=1 143
Restart=on-failure
[Install]
WantedBy=multi-user.target
Don't forget change SuccessExitStatus to code 1 143.
add a comment |
Change ExecStop to use /bin/kill and point PIDFile to the .pid file:
[Unit]
Description=Zookeeper Distributed Coordination Server
Documentation=http://zookeeper.apache.org
After=network.target
[Service]
Type=forking
User=zookeeper
Group=zookeeper
WorkingDirectory=/opt/zookeeper
Environment=ZOO_LOG_DIR=/var/log/zookeeper
ExecStart=/opt/zookeeper/bin/zkServer.sh start
PIDFile=/var/lib/zookeeper/zookeeper_server.pid
ExecStop=/bin/kill $MAINPID
SuccessExitStatus=1 143
Restart=on-failure
[Install]
WantedBy=multi-user.target
Don't forget change SuccessExitStatus to code 1 143.
add a comment |
Change ExecStop to use /bin/kill and point PIDFile to the .pid file:
[Unit]
Description=Zookeeper Distributed Coordination Server
Documentation=http://zookeeper.apache.org
After=network.target
[Service]
Type=forking
User=zookeeper
Group=zookeeper
WorkingDirectory=/opt/zookeeper
Environment=ZOO_LOG_DIR=/var/log/zookeeper
ExecStart=/opt/zookeeper/bin/zkServer.sh start
PIDFile=/var/lib/zookeeper/zookeeper_server.pid
ExecStop=/bin/kill $MAINPID
SuccessExitStatus=1 143
Restart=on-failure
[Install]
WantedBy=multi-user.target
Don't forget change SuccessExitStatus to code 1 143.
Change ExecStop to use /bin/kill and point PIDFile to the .pid file:
[Unit]
Description=Zookeeper Distributed Coordination Server
Documentation=http://zookeeper.apache.org
After=network.target
[Service]
Type=forking
User=zookeeper
Group=zookeeper
WorkingDirectory=/opt/zookeeper
Environment=ZOO_LOG_DIR=/var/log/zookeeper
ExecStart=/opt/zookeeper/bin/zkServer.sh start
PIDFile=/var/lib/zookeeper/zookeeper_server.pid
ExecStop=/bin/kill $MAINPID
SuccessExitStatus=1 143
Restart=on-failure
[Install]
WantedBy=multi-user.target
Don't forget change SuccessExitStatus to code 1 143.
edited Jan 19 at 21:10
answered Jan 19 at 20:58
Bruno WegoBruno Wego
2601316
2601316
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f54271230%2fsystemd-service-fail-when-stop%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