Files
Home-of-CS/启动.sh
T
2026-04-23 13:39:28 +08:00

29 lines
796 B
Bash
Executable File

#!/bin/bash
# 静默启动:nohup command > output.log 2>&1 &
BLOG_DIR="$HOME/hugosite"
cd "$BLOG_DIR"
# 获取 IP 地址
IPV4=$(ifconfig | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | head -1)
IPV6=$(ifconfig | grep -E "broadcast|autoconf secured" | grep "inet6"| awk '{print $2}' | head -1)
echo "🌐 服务器信息:"
echo "IPv4: $IPV4"
echo "IPv6: $IPV6"
echo ""
echo "⚡ 启动 Hugo 服务器..."
echo "请稍等..."
# 启动服务器
hugo server \
-D \
--bind 0.0.0.0 \
--port 803 \
--baseURL "http://localhost:803/" \
--appendPort=false \
--disableFastRender \
--logLevel debug
# 如果上面命令阻塞,可以按 Ctrl+C 停止,然后使用后台运行:
# hugo server -D --bind 0.0.0.0 --port 1313 --baseURL "http://$IPV4:1313/" > /tmp/hugo.log 2>&1 &