标签:cti required .sh 创建 lsb default 3.5 info nta
1、cd /etc/init.d/
2、sudo touch zookeeper(举例)
3、给服务赋权限:sudo chmod +x zookeeper
4、执行sudo vim zookeeper 命令写入执行脚本(启动脚本中的启动命令对应服务的启动命令)
#! /bin/sh ### BEGIN INIT INFO # Short-Description: Container zookeeper based on LXC # Description: Container zookeeper based on LXC # Provides: lxd # Required-Start: no # Required-Stop: no # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 ### END INIT INFO . /lib/lsb/init-functions case "$1" in start) su -l sczbbx -c ‘/home/sczbbx/zookeeper-1/zookeeper-3.5.4-beta/bin/zkServer.sh start‘ exit 0 ;; stop) su -l sczbbx -c ‘/home/sczbbx/zookeeper-1/zookeeper-3.5.4-beta/bin/zkServer.sh stop‘ exit 0 ;; *) echo ‘require start|stop‘ exit 1 ;; esac
5、然后重新加载服务:sudo systemctl daemon-reload
6、启动服务:sudo service zookeeper start;结束服务:sudo service zookeeper stop;查看系统日志:tail /var/log/syslog
标签:cti required .sh 创建 lsb default 3.5 info nta
原文地址:https://www.cnblogs.com/lk617-home/p/9635380.html