首先要创一个钉钉群,然后在群助手那边设置一个机器人
第二步 完成后复制webhook地址
第三步 编写shell脚本
vim /etc/profile.d/logininfo.sh
#!/bin/bash
ip=ifconfig |grep "inet" |awk -F " " '{print $2}'|head -n 1
shijian=date +"%Y-%m-%d-%H:%M:%S"
user=whoami
lgIP=last |head -n 1 |awk -F " " '{print $3}'
web=“webhook地址”
curl “KaTeX parse error: Expected 'EOF', got '&' at position 6: web" &̲> /dev/null \ -…{ip}]登陆时间:[
s
h
i
j
i
a
n
]
登
陆
用
户
:
[
{shijian}]登陆用户:[
shijian]登陆用户:[{user}]登陆用户IP:[${lgIP}]’”
}
最后加载配置:source /etc/profile