Ubuntu设置程序开机自启动

  1. 打开文件 /etc/rc.local
  2. 在其中编写脚本,添加要启动的服务
    可以在命令后面添加&符号,后台启动
# start zookeeper service
bash /opt/zookeeper/apache-zookeeper-3.7.0-bin/bin/zkServer.sh start &
# start Kafka service 
bash /opt/kafka/kafka_2.12-3.0.0/bin/kafka-server-start.sh /opt/kafka/kafka_2.12-3.0.0/config/server.properties &
exit 0


注意这里需要exit 0作为结尾

posted on 2021-10-13 10:31  高冷的恒哥  阅读(766)  评论(0编辑  收藏  举报