1、编写启动文件
将启动脚本放在~seata/bin/目录下
vim /usr/local/seata/bin/startup.sh
添加以下内容
【
#!/bin/bash
sleep 3
#根据自己的java家目录填写
export JAVA_HOME=/usr/local/jdk1.8.0_341
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
#启动命令
nohup sh /usr/local/seata/bin/seata-server.sh -p 8091 > /usr/local/seata/logs/seata_nohup.log 2>&1 &
】
给脚本添执行权限:chmod +x /usr/local/seata/bin/startup.sh
2、添加开机启动的进程
[root@test3 ~]#
vim /lib/systemd/system/seata.service
添加以下内容
[Unit]
Description=seata
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/local/seata/bin/startup.sh
#Restart=always
PrivateTmp=true
[Install]
WantedBy=multi-user.target
3、设置开机启动
systemctl daemon-reload
systemctl enable seata
重启测试
reboot
标签:bin,seata,sh,usr,Linux,local,守护,target From: https://www.cnblogs.com/leihongnu/p/17029736.html