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