From 6bdfa82dfa54864903ee6a0b0128cc4d3d2695f7 Mon Sep 17 00:00:00 2001 From: Eric Torres Date: Wed, 25 May 2022 17:14:11 -0700 Subject: [PATCH] Move ssh notification code into its own plugin file --- zsh/.config/zsh/.zprofile | 8 -------- zsh/.config/zsh/conf.d/ssh-login.zsh | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 zsh/.config/zsh/conf.d/ssh-login.zsh diff --git a/zsh/.config/zsh/.zprofile b/zsh/.config/zsh/.zprofile index eedba38..6bfcdf7 100755 --- a/zsh/.config/zsh/.zprofile +++ b/zsh/.config/zsh/.zprofile @@ -1,9 +1 @@ emulate sh -c 'source /etc/profile' - -# Notify on ssh login -IP="$(echo $SSH_CONNECTION | cut -d " " -f 1)" -HOSTNAME=$(hostname) -NOW=$(date +"%e %b %Y, %a %r") -EMAIL='erictorres4@protonmail.com' - -echo "Login from ${IP} on ${HOSTNAME} on ${NOW}" | neomutt -s 'SSH Login Notification' "${EMAIL}" 2>/dev/null diff --git a/zsh/.config/zsh/conf.d/ssh-login.zsh b/zsh/.config/zsh/conf.d/ssh-login.zsh new file mode 100644 index 0000000..29f549f --- /dev/null +++ b/zsh/.config/zsh/conf.d/ssh-login.zsh @@ -0,0 +1,8 @@ +# Notify on ssh login +if [[ -n $SSH_CONNECTION ]]; then + IP="$(echo $SSH_CONNECTION | cut -d " " -f 1)" + HOSTNAME=$(hostname) + NOW=$(date +"%e %b %Y, %a %r") + EMAIL='erictorres4@pm.me' + echo "Login from ${IP} on ${HOSTNAME} on ${NOW}" | neomutt -s 'SSH Login Notification' "${EMAIL}" 2>/dev/null +fi