Ubuntu Seata开机自启动服务

1、创建service文件

        在/lib/systemd/system目录下创建seata.service文件

[Unit]
Description=alibaba seata
After=network.target
Documentation=https://seata.io/zh-cn/

[Service]
User=root
Group=root
Type=forking
Environment="JAVA_HOME=/usr/local/programs/jdk-8u333-linux-x64/jdk1.8.0_333" "SEATA_IP=192.168.28.128" "LOG_HOME=/usr/local/programs/seata-1.7.1/seata.log"
ExecStart=/bin/bash /usr/local/programs/seata-1.7.1/bin/seata-server.sh start -h 192.168.28.128 -m db
ExecStop=/bin/bash /usr/local/programs/seata-1.7.1/bin/seata-server.sh stop
Restart=on-failure
PrivateTmp=true

[Install]
WantedBy=multi-user.target
Alias=seata.service
 2. 启动服务并检查状态
$ systemctl daemon-reload
$ systemctl start seata
$ systemctl status seata
$ systemctl restart seata

3. 开机自启动

$ systemctl enable seata

你可能感兴趣的:(Ubuntu20,ubuntu,linux,运维)