#!/bin/bash # # 开始要检查安装nvidia驱动 if [ "$#" -lt 3 ]; then echo "用法: $0 " exit 1 fi git_url=$1 pkgname=$(basename $git_url) port=$2 usrname=$(id -un) grpname=$(id -gn) pkg_home=$(pwd)/$pkgname venvpath=$pkg_home/$pkgname.env git clone $git_url if [ ! -d "$pkg_home" ];then echo git clone $git_url error exit 1 fi cd $pkg_home python3 -m venv $venvpath source $venvpath/bin/activate pip install setuptools wheel pip install git+https://git.kaiyuancloud.cn/yumoqing/apppublic pip install git+https://git.kaiyuancloud.cn/yumoqing/sqlor pip install git+https://git.kaiyuancloud.cn/yumoqing/ahserver pip install -r requirements.txt mkdir $pkg_home/script cat <$pkg_home/script/$pkgname.service [Unit] Wants=systemd-networkd.service [Service] User=$usrname Group=$grpname WorkingDirectory=$pkg_home # ExecStart=killname app/$3 ExecStart=$venvpath/bin/python app/$3 -p $port StandardOutput=append:/var/log/$pkgname/$pkgname.log StandardError=append:/var/log/$pkgname/$pkgname.log SyslogIdentifier=DeepSeek32B-kyyds671b.log [Install] WantedBy=multi-user.target EOF sudo ln -s $pkg_home/script/$pkgname.service /etc/systemd/system sudo mkdir /var/log/$pkgname sudo systemctl start $pkgname.service