系统centos7
[root@localhost system]# cd /etc/systemd/system
[root@localhost system]# vim zkServer.service
[Unit]
Description=zookeeper service
Requires=network.target
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
WorkingDirectory=/usr/local/zookeeper-3.6.2
Environment="JAVA_HOME=/usr/local/jdk1.8.0_271"
ExecStart=/usr/local/zookeeper-3.6.2/bin/zkServer.sh start
ExecStop=/usr/local/zookeeper-3.6.2/bin/zkServer.sh stop
Restart=on-abort
TimeoutSec=600
[Install]
WantedBy=multi-user.target
[root@localhost system]# systemctl daemon-reload
[root@localhost system]# systemctl enable zkServer.service
[root@localhost system]# systemctl start zkServer.service
[root@localhost system]# systemctl status zkServer.service
网友评论