Files
termux/~/.zprofile
T
chicrobot e25f8a5ea5 上传文件至 ~
开机启动运行脚本
2025-06-04 16:50:25 +00:00

87 lines
2.7 KiB
Bash
Raw 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.
if [ "$(whoami)" = "root" ]; then
echo -e "\e[1;35m"
echo "ubuntu已启动,开机脚本:.zshrc"
echo -e "\e[0m"
echo -e "0、startvnc或novnc启动图形页面,后者可浏览器访问,密码123456\n"
# 如果以root启动且没有gitea进程,则后台启动gitea并记录日志
if ! pgrep -x "gitea" > /dev/null; then
echo -e "1、gitea启动中...\n"
su - git -c "nohup /usr/local/bin/gitea web -c /etc/gitea/app.ini > /var/lib/gitea/log/gitea.log 2>&1 &"
if pgrep -x gitea > /dev/null; then
echo "\e[32m"
echo "gitea已启动,默认3000端口,root密码12345678:"
echo "\e[0m"
else
echo "\e[31m"
echo "gitea启动失败"
echo "\e[0m"
fi
pgrep -a gitea
echo ""
fi
# 启动ollama
if ! pgrep -x "ollama" > /dev/null; then
echo -e "2、ollama启动中...\n"
nohup ollama serve > /usr/local/lib/ollama/log/ollama.log 2>&1 &
if pgrep -x ollama > /dev/null; then
echo "\e[32m"
echo "ollama已启动,默认11434端口:"
echo "\e[0m"
else
echo "\e[31m"
echo "ollama启动失败"
echo "\e[0m"
fi
pgrep -a ollama
echo ""
fi
# 启动mysql
if ! pgrep -x "mysqld" > /dev/null; then
echo -e "3、mysql启动中...\n"
service mysql start
if pgrep -x mysqld > /dev/null; then
echo "\e[32m"
echo "mysql已启动,默认3306端口:"
echo "\e[0m"
else
echo "\e[31m"
echo "mysql启动失败"
echo "\e[0m"
fi
pgrep -a mysql
echo ""
fi
# 启动sqlynx
if ! (jps -l | grep sqlynx) > /dev/null; then
echo -e "4、sqlynx,web版数据库可视化管理工具启动中...\n"
sh sqlynx_linux_3.7.0/sqlynx-ide.sh start
if (jps -l | grep sqlynx) > /dev/null; then
echo "\e[32m"
echo "sqlynx已启动,默认18888端口:"
echo "\e[0m"
else
echo "\e[31m"
echo "sqlynx启动失败"
echo "\e[0m"
fi
jps -l | grep sqlynx
echo ""
fi
# 启动web版vscode
if ! pgrep -x "code-server" > /dev/null; then
echo -e "5、code-server启动中...\n"
nohup code-server > /usr/local/lib/code-server/log/code-server.log 2>&1 &
if pgrep -x code-server > /dev/null; then
echo "\e[32m"
echo "code-server已启动,默认18080端口,密码123456:"
echo "\e[0m"
else
echo "\e[31m"
echo "code-server启动失败"
echo "\e[0m"
fi
pgrep -a code-server
echo ""
fi
fi