From 85654f51a01a9639d870ce2a32820341676dd0a0 Mon Sep 17 00:00:00 2001 From: "Alexander I. Chebykin" Date: Sat, 29 Oct 2022 21:15:02 +0300 Subject: [PATCH] on-start script updated, localized scripts added on-start script updated, localized scripts added --- README.md | 2 +- scripts/unix/etc/cai-watchdog/on-start | 2 +- scripts/unix/etc/cai-watchdog/on-start-ru | 11 +++++++++++ scripts/unix/etc/cai-watchdog/on-stop-ru | 11 +++++++++++ .../unix/usr/lib/systemd/system/cai-watchdog.service | 1 - 5 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 scripts/unix/etc/cai-watchdog/on-start-ru create mode 100644 scripts/unix/etc/cai-watchdog/on-stop-ru diff --git a/README.md b/README.md index 6c0370f..47f7a61 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ Next you need to find your Telegram Chat ID. ### Service configuration (*nix) -If you want to get messages when watchdog service is stopped, uncomment following line: ```ExecStopPost=send-telegram 'ATTENTION! Watchdog is stopped!'``` or ```#ExecStopPost=/usr/local/sbin/cai-watchdog-stopped``` if you want message with exclamation icon (⚠) +If you want to get messages when watchdog service is stopped, uncomment following line: ```ExecStopPost=/etc/cai-watchdog/on-stop``` ## User logins monitoring (*nix) diff --git a/scripts/unix/etc/cai-watchdog/on-start b/scripts/unix/etc/cai-watchdog/on-start index ab8faeb..eb399ac 100644 --- a/scripts/unix/etc/cai-watchdog/on-start +++ b/scripts/unix/etc/cai-watchdog/on-start @@ -8,4 +8,4 @@ if [[ -z "$APP_PATH" ]] ; then fi source ${APP_PATH}/inc-icons -${APP_PATH}/send-telegram "${ICON_INFO} ATTENTION! Watchdog is stopped!" +${APP_PATH}/send-telegram "${ICON_INFO} Watchdog is started!" diff --git a/scripts/unix/etc/cai-watchdog/on-start-ru b/scripts/unix/etc/cai-watchdog/on-start-ru new file mode 100644 index 0000000..bae0af2 --- /dev/null +++ b/scripts/unix/etc/cai-watchdog/on-start-ru @@ -0,0 +1,11 @@ +#!/bin/bash +APP_PATH=$(dirname "$0") # relative +APP_PATH=$(cd "$APP_PATH" && pwd) # absolutized and normalized +if [[ -z "$APP_PATH" ]] ; then + # error; for some reason, the path is not accessible + # to the script (e.g. permissions re-evaled after suid) + APP_PATH="/etc/cai-watchdog" +fi + +source ${APP_PATH}/inc-icons +${APP_PATH}/send-telegram "${ICON_INFO} Watchdog запущен!" diff --git a/scripts/unix/etc/cai-watchdog/on-stop-ru b/scripts/unix/etc/cai-watchdog/on-stop-ru new file mode 100644 index 0000000..691dd12 --- /dev/null +++ b/scripts/unix/etc/cai-watchdog/on-stop-ru @@ -0,0 +1,11 @@ +#!/bin/bash +APP_PATH=$(dirname "$0") # relative +APP_PATH=$(cd "$APP_PATH" && pwd) # absolutized and normalized +if [[ -z "$APP_PATH" ]] ; then + # error; for some reason, the path is not accessible + # to the script (e.g. permissions re-evaled after suid) + APP_PATH="/etc/cai-watchdog" +fi + +source ${APP_PATH}/inc-icons +${APP_PATH}/send-telegram "${ICON_WARNING} ВНИМАНИЕ! Watchdog остановлен!" diff --git a/scripts/unix/usr/lib/systemd/system/cai-watchdog.service b/scripts/unix/usr/lib/systemd/system/cai-watchdog.service index ead7ceb..2ae1ba8 100644 --- a/scripts/unix/usr/lib/systemd/system/cai-watchdog.service +++ b/scripts/unix/usr/lib/systemd/system/cai-watchdog.service @@ -7,7 +7,6 @@ Group=www Type=simple ExecStart=/usr/local/sbin/cai-watchdog #ExecStopPost=/etc/cai-watchdog/on-stop -#ExecStopPost=send-telegram 'ATTENTION! Watchdog is stopped!' KillMode=control-group NotifyAccess=all -- 2.51.0