SSH/RDP 发送提醒当登录时
目录
申请机器人
Telegram
申请步骤
- 注册 telegram
- 寻找
@BotFather账号 - 输入
/newBot - 输入
名称申请
API 测试
- 获取聊天ID: https://api.telegram.org/bot123456:abcd/getUpdates
- 发送消息: https://api.telegram.org/bot123456:abcd/sendMessage?chat_id=1062857492&text=Hello
登录执行命令
RDP
配置计划任务
- 找到
TaskScheduler - 右侧
Create Task...
创建计划任务
- 设置
General- Name:
LoginSayHello
- Name:
- 设置
Tigger- Begin the task:
On workstation unlock
- Begin the task:
- 设置
Actions- Program/script:
curl - Add arguments:
https://api.telegram.org/bot123456:abcd/sendMessage?chat_id=1062857492&text=%23Logined%0AAzure
- Program/script:
- 设置
Conditions- Power Start the task only if the computer is on AC power
SSH
配置登录命令
echo "echo Hello `whoami`" > /etc/profile.d/logined.sh
配置发送消息
echo "curl https://api.telegram.org/bot123456:abcd/sendMessage?chat_id=1062857492&text=%23Logined%0AVirmach" > /etc/profile.d/logined.sh