mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-09-09 19:56:19 +00:00
modified: x-ui.sh
This commit is contained in:
parent
cf358752b3
commit
7b2da26853
1 changed files with 22 additions and 23 deletions
45
x-ui.sh
45
x-ui.sh
|
@ -166,11 +166,9 @@ uninstall() {
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
systemctl stop x-ui
|
service x-ui stop
|
||||||
systemctl disable x-ui
|
rc-update del x-ui
|
||||||
rm /etc/systemd/system/x-ui.service -f
|
rm /etc/systemd/system/x-ui.service -f
|
||||||
systemctl daemon-reload
|
|
||||||
systemctl reset-failed
|
|
||||||
rm /etc/x-ui/ -rf
|
rm /etc/x-ui/ -rf
|
||||||
rm /usr/local/x-ui/ -rf
|
rm /usr/local/x-ui/ -rf
|
||||||
|
|
||||||
|
@ -245,7 +243,7 @@ start() {
|
||||||
echo ""
|
echo ""
|
||||||
LOGI "Panel is running, No need to start again, If you need to restart, please select restart"
|
LOGI "Panel is running, No need to start again, If you need to restart, please select restart"
|
||||||
else
|
else
|
||||||
systemctl start x-ui
|
service x-ui start
|
||||||
sleep 2
|
sleep 2
|
||||||
check_status
|
check_status
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
|
@ -266,7 +264,7 @@ stop() {
|
||||||
echo ""
|
echo ""
|
||||||
LOGI "Panel stopped, No need to stop again!"
|
LOGI "Panel stopped, No need to stop again!"
|
||||||
else
|
else
|
||||||
systemctl stop x-ui
|
service x-ui stop
|
||||||
sleep 2
|
sleep 2
|
||||||
check_status
|
check_status
|
||||||
if [[ $? == 1 ]]; then
|
if [[ $? == 1 ]]; then
|
||||||
|
@ -282,7 +280,7 @@ stop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
restart() {
|
restart() {
|
||||||
systemctl restart x-ui
|
service x-ui restart
|
||||||
sleep 2
|
sleep 2
|
||||||
check_status
|
check_status
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
|
@ -296,14 +294,14 @@ restart() {
|
||||||
}
|
}
|
||||||
|
|
||||||
status() {
|
status() {
|
||||||
systemctl status x-ui -l
|
rc-status -l
|
||||||
if [[ $# == 0 ]]; then
|
if [[ $# == 0 ]]; then
|
||||||
before_show_menu
|
before_show_menu
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
enable() {
|
enable() {
|
||||||
systemctl enable x-ui
|
rc-update add x-ui boot
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
LOGI "x-ui Set to boot automatically on startup successfully"
|
LOGI "x-ui Set to boot automatically on startup successfully"
|
||||||
else
|
else
|
||||||
|
@ -316,7 +314,7 @@ enable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
disable() {
|
disable() {
|
||||||
systemctl disable x-ui
|
rc-update del x-ui boot
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
LOGI "x-ui Autostart Cancelled successfully"
|
LOGI "x-ui Autostart Cancelled successfully"
|
||||||
else
|
else
|
||||||
|
@ -447,7 +445,7 @@ check_status() {
|
||||||
if [[ "${temp}" != "x-ui" ]]; then
|
if [[ "${temp}" != "x-ui" ]]; then
|
||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
temp=$(rc-status | grep x-ui | awk '{print $3}' | cut -d "(" -f2 | cut -d ")" -f1)
|
temp=$(rc-status -a | grep x-ui | awk '{print $3}' | cut -d "(" -f2 | cut -d ")" -f1)
|
||||||
if [[ "${temp}" == "started" ]]; then
|
if [[ "${temp}" == "started" ]]; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
|
@ -456,8 +454,8 @@ check_status() {
|
||||||
}
|
}
|
||||||
|
|
||||||
check_enabled() {
|
check_enabled() {
|
||||||
temp=$(systemctl is-enabled x-ui)
|
temp=$(rc-status boot| grep x-ui)
|
||||||
if [[ "${temp}" == "enabled" ]]; then
|
if [[ ! -z temp ]]; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
|
@ -665,7 +663,7 @@ update_geo() {
|
||||||
mkdir -p ${binFolder}
|
mkdir -p ${binFolder}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
systemctl stop x-ui
|
service x-ui stop
|
||||||
cd ${binFolder}
|
cd ${binFolder}
|
||||||
rm -f geoip.dat geosite.dat geoip_IR.dat geosite_IR.dat geoip_VN.dat geosite_VN.dat
|
rm -f geoip.dat geosite.dat geoip_IR.dat geosite_IR.dat geoip_VN.dat geosite_VN.dat
|
||||||
wget -N https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
|
wget -N https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
|
||||||
|
@ -674,7 +672,7 @@ update_geo() {
|
||||||
wget -O geosite_IR.dat -N https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
|
wget -O geosite_IR.dat -N https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
|
||||||
wget -O geoip_VN.dat https://github.com/vuong2023/vn-v2ray-rules/releases/latest/download/geoip.dat
|
wget -O geoip_VN.dat https://github.com/vuong2023/vn-v2ray-rules/releases/latest/download/geoip.dat
|
||||||
wget -O geosite_VN.dat https://github.com/vuong2023/vn-v2ray-rules/releases/latest/download/geosite.dat
|
wget -O geosite_VN.dat https://github.com/vuong2023/vn-v2ray-rules/releases/latest/download/geosite.dat
|
||||||
systemctl start x-ui
|
service x-ui start
|
||||||
echo -e "${green}Geosite.dat + Geoip.dat + geoip_IR.dat + geosite_IR.dat have been updated successfully in bin folder '${binfolder}'!${plain}"
|
echo -e "${green}Geosite.dat + Geoip.dat + geoip_IR.dat + geosite_IR.dat have been updated successfully in bin folder '${binfolder}'!${plain}"
|
||||||
before_show_menu
|
before_show_menu
|
||||||
}
|
}
|
||||||
|
@ -1055,7 +1053,7 @@ iplimit_main() {
|
||||||
read -rp "Please enter new Ban Duration in Minutes [default 30]: " NUM
|
read -rp "Please enter new Ban Duration in Minutes [default 30]: " NUM
|
||||||
if [[ $NUM =~ ^[0-9]+$ ]]; then
|
if [[ $NUM =~ ^[0-9]+$ ]]; then
|
||||||
create_iplimit_jails ${NUM}
|
create_iplimit_jails ${NUM}
|
||||||
systemctl restart fail2ban
|
rc-service fail2ban restart
|
||||||
else
|
else
|
||||||
echo -e "${red}${NUM} is not a number! Please, try again.${plain}"
|
echo -e "${red}${NUM} is not a number! Please, try again.${plain}"
|
||||||
fi
|
fi
|
||||||
|
@ -1142,13 +1140,14 @@ install_iplimit() {
|
||||||
create_iplimit_jails
|
create_iplimit_jails
|
||||||
|
|
||||||
# Launching fail2ban
|
# Launching fail2ban
|
||||||
if ! systemctl is-active --quiet fail2ban; then
|
temp=$(rc-status -a | grep fail2ban | awk '{print $3}' | cut -d "(" -f2 | cut -d ")" -f1)
|
||||||
systemctl start fail2ban
|
if [[ "${temp}" == "started" ]]; then
|
||||||
systemctl enable fail2ban
|
rc-service fail2ban start
|
||||||
|
rc-service add fail2ban boot
|
||||||
else
|
else
|
||||||
systemctl restart fail2ban
|
rc-service fail2ban restart
|
||||||
fi
|
fi
|
||||||
systemctl enable fail2ban
|
rc-service add fail2ban boot
|
||||||
|
|
||||||
echo -e "${green}IP Limit installed and configured successfully!${plain}\n"
|
echo -e "${green}IP Limit installed and configured successfully!${plain}\n"
|
||||||
before_show_menu
|
before_show_menu
|
||||||
|
@ -1164,13 +1163,13 @@ remove_iplimit() {
|
||||||
rm -f /etc/fail2ban/filter.d/3x-ipl.conf
|
rm -f /etc/fail2ban/filter.d/3x-ipl.conf
|
||||||
rm -f /etc/fail2ban/action.d/3x-ipl.conf
|
rm -f /etc/fail2ban/action.d/3x-ipl.conf
|
||||||
rm -f /etc/fail2ban/jail.d/3x-ipl.conf
|
rm -f /etc/fail2ban/jail.d/3x-ipl.conf
|
||||||
systemctl restart fail2ban
|
rc-service fail2ban restart
|
||||||
echo -e "${green}IP Limit removed successfully!${plain}\n"
|
echo -e "${green}IP Limit removed successfully!${plain}\n"
|
||||||
before_show_menu
|
before_show_menu
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
rm -rf /etc/fail2ban
|
rm -rf /etc/fail2ban
|
||||||
systemctl stop fail2ban
|
rc-service fail2ban stop
|
||||||
case "${release}" in
|
case "${release}" in
|
||||||
ubuntu | debian)
|
ubuntu | debian)
|
||||||
apt-get remove -y fail2ban
|
apt-get remove -y fail2ban
|
||||||
|
|
Loading…
Reference in a new issue