Иногда не хочется перезапускать сервис "на всякий случай", но вот если он реально завис — другое дело. Вот простой способ проверять, активен ли сервис, и перезапускать его при зависании:
#!/bin/bash
SERVICE="nginx"
if ! systemctl is-active --quiet "$SERVICE"; then echo "$(date): $SERVICE не активен, пробую перезапустить..." >> /var/log/service_monitor.log systemctl restart "$SERVICE" else echo "$(date): $SERVICE работает нормально" >> /var/log/service_monitor.log fi
🛠 Можно добавить в крон, например, проверку каждые 5 минут:
*/5 * * * * /usr/local/bin/check_nginx.sh
📁 Не забудь сделать скрипт исполняемым:
chmod +x /usr/local/bin/check_nginx.sh
💡 Можно заменить nginx на любой другой системный сервис.
Иногда не хочется перезапускать сервис "на всякий случай", но вот если он реально завис — другое дело. Вот простой способ проверять, активен ли сервис, и перезапускать его при зависании:
#!/bin/bash
SERVICE="nginx"
if ! systemctl is-active --quiet "$SERVICE"; then echo "$(date): $SERVICE не активен, пробую перезапустить..." >> /var/log/service_monitor.log systemctl restart "$SERVICE" else echo "$(date): $SERVICE работает нормально" >> /var/log/service_monitor.log fi
🛠 Можно добавить в крон, например, проверку каждые 5 минут:
*/5 * * * * /usr/local/bin/check_nginx.sh
📁 Не забудь сделать скрипт исполняемым:
chmod +x /usr/local/bin/check_nginx.sh
💡 Можно заменить nginx на любой другой системный сервис.
Unlimited number of subscribers per channel Done! Now you’re the proud owner of a Telegram channel. The next step is to set up and customize your channel. On Tuesday, some local media outlets included Sing Tao Daily cited sources as saying the Hong Kong government was considering restricting access to Telegram. Privacy Commissioner for Personal Data Ada Chung told to the Legislative Council on Monday that government officials, police and lawmakers remain the targets of “doxxing” despite a privacy law amendment last year that criminalised the malicious disclosure of personal information. The public channel had more than 109,000 subscribers, Judge Hui said. Ng had the power to remove or amend the messages in the channel, but he “allowed them to exist.” Telegram iOS app: In the “Chats” tab, click the new message icon in the right upper corner. Select “New Channel.”
from us