mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-06-28 12:16:53 +00:00
Update telegram-notifier.sh
This commit is contained in:
parent
69ed8ffe58
commit
71ad91f5f9
@ -690,25 +690,41 @@ EOF
|
|||||||
systemctl start proxmox-telegram.service
|
systemctl start proxmox-telegram.service
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Menú principal
|
# Menú principal
|
||||||
main_menu() {
|
main_menu() {
|
||||||
local extra_option=""
|
|
||||||
if [[ -f /etc/systemd/system/proxmox-telegram.service ]]; then
|
|
||||||
extra_option="8 \"\$(translate \"Eliminar Servicio de Notificaciones\")\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
OPTION=$(eval whiptail --title "\"\$(translate \"Configuración de Notificaciones de Proxmox\")\"" \
|
# Preparar las opciones del menú
|
||||||
--menu "\"\$(translate \"Elige una opción:\")\"" 20 70 10 \
|
local menu_options=(
|
||||||
"1" "\"\$(translate \"Configurar Telegram\")\"" \
|
"1" "$(translate "Configurar Telegram")"
|
||||||
"2" "\"\$(translate \"Configurar Notificaciones\")\"" \
|
"2" "$(translate "Configurar Notificaciones")"
|
||||||
"3" "\"\$(translate \"Iniciar Servicio de Notificaciones\")\"" \
|
"3" "$(translate "Iniciar Servicio de Notificaciones")"
|
||||||
"4" "\"\$(translate \"Detener Servicio de Notificaciones\")\"" \
|
"4" "$(translate "Detener Servicio de Notificaciones")"
|
||||||
"5" "\"\$(translate \"Verificar Estado del Servicio\")\"" \
|
"5" "$(translate "Verificar Estado del Servicio")"
|
||||||
"7" "\"\$(translate \"Salir\")\"" \
|
)
|
||||||
$extra_option 3>&1 1>&2 2>&3)
|
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]; then exit 0; fi
|
# Añadir la opción de eliminar servicio solo si está instalado
|
||||||
|
if [[ -f /etc/systemd/system/proxmox-telegram.service ]]; then
|
||||||
|
menu_options+=(
|
||||||
|
"6" "$(translate "Eliminar Servicio de Notificaciones")"
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Añadir siempre la opción de salir al final
|
||||||
|
menu_options+=(
|
||||||
|
"7" "$(translate "Salir")"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Mostrar el menú con las opciones preparadas
|
||||||
|
OPTION=$(whiptail --title "$(translate "Configuración de Notificaciones de Proxmox")" \
|
||||||
|
--menu "$(translate "Elige una opción:")" 20 70 10 \
|
||||||
|
"${menu_options[@]}" \
|
||||||
|
3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
case "$OPTION" in
|
case "$OPTION" in
|
||||||
1) configure_telegram ;;
|
1) configure_telegram ;;
|
||||||
@ -716,8 +732,8 @@ main_menu() {
|
|||||||
3) start_notification_service ;;
|
3) start_notification_service ;;
|
||||||
4) stop_notification_service ;;
|
4) stop_notification_service ;;
|
||||||
5) check_service_status ;;
|
5) check_service_status ;;
|
||||||
|
6) remove_systemd_service ;;
|
||||||
7) exit 0 ;;
|
7) exit 0 ;;
|
||||||
8) remove_systemd_service ;;
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user