阿里云服务器常见操作
`
liunx服务启动
切换到项目路径(其他模块儿自己改最后一层路径)
cd /opt/git/tl/teamleader/tl-service
拉取最新代码
git pull
执行打包
./package-uat.sh
切换到tl启动的目录
cd /home/tl
原来的包重命名
mv tl-service-0.0.1-SNAPSHOT.jar tl-service-$(date +%Y-%m-%d_%H-%M-%S).jar
切换到jar包路径
cd /opt/git/tl/teamleader/tl-service/target
复制或移动jar包到指定文件夹
cp tl-service-0.0.1-SNAPSHOT.jar /home/tl/
杀掉原来的进程并后台启动自己新复制过来的jar包
ps -ef | grep tl-service | grep -v grep | awk '{print $2}' | xargs kill -9
后台启动
nohup java -jar tl-service-0.0.1-SNAPSHOT.jar > tl.out &
`
其他问题:
//查看防火墙状态
systemctl status firewalld.service
//启动防火墙
systemctl start firewalld.service
//关闭防火墙
systemctl stop firewalld.service
//重启防火墙
systemctl restart firewalld.service
//在开机时启用一个服务
systemctl enable firewalld.service
//在开机时禁用一个服务
systemctl disable firewalld.service
//防火墙开放端口查看
firewall-cmd --list-all
//结果
public (active)
target: default
icmp-block-inversion: no
interfaces: eth0
sources:
services: cockpit dhcpv6-client ssh
ports: 3306/tcp 8080/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
//添加开放端口
firewall-cmd --zone=public --add-port=8080/tcp --permanent
//重载防火墙