Last active
August 9, 2022 23:41
-
-
Save tranduydat/fb7d602d5706ef2b819bb1ed5807465a to your computer and use it in GitHub Desktop.
Auto run curl when a user logged in Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Append it in `/etc/bash.bashrc` | |
if [[ -n $SSH_CONNECTION ]] ; then | |
curl "https://HOST/message?token=XXX" -F "title=user:$USER logged -> $(cat /proc/sys/kernel/hostname)" -F "message=IP: $(who am i| awk -F'[()]' '{print $2}'), at: $(date)" -F "priority=9" > /dev/null | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment