Simple Linux Panel
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mdserver-web/plugins/tgclient/install.sh

56 lines
1.2 KiB

2 years ago
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
VERSION=$2
# pip3 install ccxt
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
fi
pip3 install telethon
Install_App()
{
5 months ago
echo '正在安装脚本文件...'
2 years ago
mkdir -p $serverPath/source
mkdir -p $serverPath/tgclient
echo "${VERSION}" > $serverPath/tgclient/version.pl
cp -rf ${rootPath}/plugins/tgclient/startup/* $serverPath/tgclient
cd ${rootPath} && python3 ${rootPath}/plugins/tgclient/index.py start
cd ${rootPath} && python3 ${rootPath}/plugins/tgclient/index.py initd_install
5 months ago
echo '安装完成'
2 years ago
}
Uninstall_App()
{
if [ -f /usr/lib/systemd/system/tgclient.service ];then
systemctl stop tgclient
systemctl disable tgclient
rm -rf /usr/lib/systemd/system/tgclient.service
systemctl daemon-reload
fi
if [ -f $serverPath/tgclient/initd/tgclient ];then
$serverPath/tgclient/initd/tgclient stop
fi
rm -rf $serverPath/tgclient
5 months ago
echo "Uninstall_redis"
2 years ago
}
action=$1
if [ "${1}" == 'install' ];then
Install_App
else
Uninstall_App
fi