49 lines
1.0 KiB
Bash
Executable File
49 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# 变量
|
|
#
|
|
# home
|
|
# user
|
|
# passwd
|
|
# modelpath
|
|
# modelname
|
|
# gpucnt
|
|
# port
|
|
#
|
|
# 开始要检查安装nvidia驱动
|
|
|
|
if [ "$#" -lt 3 ]; then
|
|
echo "用法: $0 <git_url1> <port> <python file under app folder>"
|
|
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
|
|
pip install git+$git_url
|
|
cd $pkg_home
|
|
python3 -m venv $envpath
|
|
source $envpath/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 <<EOF>$pkg_home/script/$pkgname.service
|
|
[Unit]
|
|
Wants=systemd-networkd.service
|
|
|
|
[Service]
|
|
User=$usrname
|
|
Group=$grpname
|
|
WorkingDirectory=$pkg_home
|
|
ExecStart=$envpath/bin/python app/$3
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
sudo ln -s $pkg_home/script/$pkgname.service /etc/systemd/system
|
|
sudo systemctl start $pkgname.service
|