From 8b7d4f1688078500c457a20182443c12b6b28b75 Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Sat, 3 Sep 2022 14:23:11 +0200 Subject: [PATCH] misc/ssh_tg_notify: strip expected stat error message --- roles/misc/ssh_tg_notify/templates/notify.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/misc/ssh_tg_notify/templates/notify.sh b/roles/misc/ssh_tg_notify/templates/notify.sh index bc3b2e3..b4487b9 100644 --- a/roles/misc/ssh_tg_notify/templates/notify.sh +++ b/roles/misc/ssh_tg_notify/templates/notify.sh @@ -11,7 +11,7 @@ URL="https://api.telegram.org/bot$KEY/sendMessage" if [[ "$PAM_SERVICE" == "sshd" && "$PAM_TYPE" == "open_session" && "$PAM_USER" != "git" && -z "$TMUX" ]]; then IP="$PAM_RHOST" cache_file="${CACHE_DIR}/${IP}-${PAM_USER}" - cache_mtime=$(stat --format="%Y" "$cache_file") + cache_mtime=$(stat --format="%Y" "$cache_file" 2>/dev/null) current_time=$(date +%s) touch "$cache_file" if (( cache_mtime > (current_time - 4*60*60) )); then