-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
52 lines (44 loc) · 1.39 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
apt-get update -y
apt-get upgrade -y
cd
git clone https://github.com/Ashaxer/VirtualizorPanel
cd VirtualizorPanel
apt-get install python3
apt-get install python3-pip
pip install -r requirements.txt
while [[ -z "$tk" ]]; do
echo "Bot token: "
read -r tk
if [[ $tk == $'\0' ]]; then
echo "Invalid input. Token cannot be empty."
unset tk
fi
done
while [[ -z "$px" ]]; do
echo "Proxy (optional): "
read -r px
break
done
while [[ -z "$crontabs" ]]; do
echo "Would you like to cereate a cronjob task on every reboot? [y/n] : "
read -r crontabs
if [[ $crontabs == $'\0' ]]; then
echo "Invalid input. Please choose y or n."
unset crontabs
elif [[ ! $crontabs =~ ^[yn]$ ]]; then
echo "${crontabs} is not a valid option. Please choose y or n."
unset crontabs
fi
done
cat > "/root/VirtualizorPanel/config.env" <<EOL
TELEGRAM_BOT_TOKEN = ${tk}
TELEGRAM_PROXY = ${px}
# EXAMPLE SOCKS5 PROXY: socks5://127.0.0.1:2080
# EXAMPLE HTTP PROXY: http://127.0.0.1:2081
EOL
if [[ "$crontabs" == "y" ]]; then
# create crontabs
{ crontab -l -u root; echo "@reboot /bin/bash screen -dmS VirtualizorPanel sh -c 'cd /root/VirtualizorPanel/ && /usr/bin/python3 telegrambot.py' >/dev/null 2>&1"; } | crontab -u root -
fi
screen -dmS VirtualizorPanel sh -c 'cd /root/VirtualizorPanel/ && /usr/bin/python3 telegrambot.py'
echo "Bot started"