Seata设置开机自启动
1:创建启动文件 vim /etc/init.d/seata#!/bin/bash
#
#chkconfig: 2345 55 25
#description: seata
#processname: seata
export JAVA_HOME=/usr/java/jdk1.8.0_121
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
SEATA_HOME=/home/seata
case $1 in
start)
nohup sh $SEATA_HOME/bin/seata-server.sh > /home/seata/seata.out 2>&1 &
echo "seata is started"
;;
stop)
ps -ef | grep seata | grep -v grep | awk '{print $2}' | xargs kill -9
echo "seata is stopped"
;;
restart)
ps -ef | grep seata | grep -v grep | awk '{print $2}' | xargs kill -9
echo "seata is stopped"
sleep 1
nohup sh $SEATA_HOME/bin/seata-server.sh > /home/seata/seata.out 2>&1 &
echo "seata is started"
;;
*)
echo "start|stop|restart"
;;
esac
exit 0
3:添加服务到开机项 chkconfig --add seata
4:设置为开机启动 chkconfig seata on
5:测试 service seata start
6:说明:如果是注册中心和配置中心选择的是nacos,则自启动会失败需要等待nacos启动以后手动启动seata服务。