Update Titan.sh

This commit is contained in:
smeb y 2024-03-14 16:57:06 +08:00 committed by GitHub
parent 7ae48094de
commit dbbf4a1448
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,10 +1,15 @@
#!/bin/bash #!/bin/bash
# 脚本保存路径 # 脚本保存路径
SCRIPT_PATH="$HOME/Titan.sh" SCRIPT_PATH="$HOME/Titan.sh"
# 函数定义 # 函数定义
start_node() { start_node() {
sudo apt update
sudo apt install screen -y
if [ "$1" = "first-time" ]; then if [ "$1" = "first-time" ]; then
echo "首次启动节点..." echo "首次启动节点..."
# 下载并解压 titan-node 到 /usr/local/bin # 下载并解压 titan-node 到 /usr/local/bin
@ -12,8 +17,8 @@ start_node() {
wget -c https://github.com/Titannet-dao/titan-node/releases/download/0.1.12/titan_v0.1.12_linux_amd64.tar.gz -O - | sudo tar -xz -C /usr/local/bin --strip-components=1 wget -c https://github.com/Titannet-dao/titan-node/releases/download/0.1.12/titan_v0.1.12_linux_amd64.tar.gz -O - | sudo tar -xz -C /usr/local/bin --strip-components=1
titan-edge daemon start --init --url https://test-locator.titannet.io:5000/rpc/v0 titan-edge daemon start --init --url https://test-locator.titannet.io:5000/rpc/v0
else else
echo "启动节点并后台运行请使用查看日志或者Titan面板功能..." echo "启动节点监控并后台运行请使用查看日志或者Titan面板功能..."
nohup titan-edge daemon start --init --url https://test-locator.titannet.io:5000/rpc/v0 > edge.log 2>&1 & screen -dmS titan bash -c 'titan-edge daemon start --init --url https://test-locator.titannet.io:5000/rpc/v0'
fi fi
} }
@ -31,7 +36,7 @@ stop_node() {
check_logs() { check_logs() {
echo "查看日志..." echo "查看日志..."
cat edge.log screen -r titan
} }
# 主菜单 # 主菜单