lego-monitoring/wrappers/login_wrapper.sh
2025-01-07 02:52:19 +03:00

12 lines
298 B
Bash
Executable file

#!/bin/bash
mydir=$(dirname "$0")
sudo "$mydir/send_login_alert.sh"
shell=$(getent passwd $LOGNAME | cut -d: -f7)
if [[ -n $SSH_ORIGINAL_COMMAND ]] # command given, so run it
then
exec "$shell" -c "$SSH_ORIGINAL_COMMAND"
else # no command, so interactive login shell
exec "$shell" -il
fi