Files
testgitea/easytiersetup.sh
2026-06-07 12:30:50 +08:00

31 lines
840 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
echo "==>setup easytier config"
# 不能多行替换,需要在-i后面添加-e并且每行替换内容前都要添加-e
# sed -i.bak '14c\uri = "tcp://39.108.52.138:11010"; 17c\network_name = "ctyuntest"; 18c\network_secret = "123456"' /opt/easytier/config/default.conf
uri='uri = "tcp://39.108.52.138:11010"'
name='network_name = "ctyuntest"'
pw='network_secret = "123456"'
sed -i.bak -e "14c\\$uri" -e "17c\\$name" -e "18c\\$pw" /opt/easytier/config/default.conf
# # 创建 sed 脚本
# cat > replace.sed << 'EOF'
# uri = "tcp://39.108.52.138:11010"
# network_name = "ctyuntest"
# network_secret = "123456"
# EOF
# # 执行
# sed -i.bak -f replace.sed /opt/easytier/config/default.conf
# # 可选:清理临时文件
# rm -f replace.sed
echo "==>setup config done"
# restart easytier
systemctl restart easytier