centos7 自定义添加系统服务
原创小于 1 分钟linuxcentos
自定义添加系统服务
[Unit]
Description=zookeeper
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/root/apache-zookeeper-3.7.0-bin/bin/zkServer.sh start
ExecReload=/root/apache-zookeeper-3.7.0-bin/bin/zkServer.sh restart
ExecStop=/root/apache-zookeeper-3.7.0-bin/bin/zkServer.sh stop
[Install]
WantedBy=multi-user.target
文件放入/usr/lib/systemd/system/
设置自启
systemctl enable zookeeper.service systemctl daemon-reload
查看是否自启
systemctl is-enabled zookeeper.service
取消自启
systemctl disable zookeeper.service systemctl daemon-reload