DeadOrNot
Daily check to see if user is still responsive - asks if okay, sends email if no reply.
How It Works
- 1. User messages → updates lastseen timestamp
- Cron runs daily → sets checkflag if timeout exceeded
- Agent reads checkflag → asks user if they're okay
- No reply → calls sendmail.py to notify emergency contact
Quick Start
1. Initialize
CODEBLOCK0
2. Configure
Create config file ~/.openclaw/apps/deadornot/config:
CODEBLOCK1
3. Set up Cron
CODEBLOCK2
Configuration
| Variable | Default | Description |
|---|
| TIMEOUTHOURS | 24 | Hours without message before check |
| NOTIFYEMAIL |
- | Emergency contact (required) |
| MESSAGE | "User is unresponsive!" | Email content |
| ASK_HOUR | 10 | When to ask (0-23) |
| SMTP_SERVER | smtp.qq.com | SMTP server |
| SMTP_PORT | 465 | SMTP port |
| SMTP_EMAIL | - | Sender email |
| SMTP_PASSWORD | - | SMTP auth code |
DeadOrNot
每日检查用户是否仍在活跃——询问用户是否安好,若无回复则发送邮件。
工作原理
- 1. 用户发送消息 → 更新 lastseen 时间戳
- 定时任务每日运行 → 若超时则设置 checkflag 标记
- 代理读取 checkflag → 询问用户是否安好
- 无回复 → 调用 sendmail.py 通知紧急联系人
快速开始
1. 初始化
bash
mkdir -p ~/.openclaw/apps/deadornot
2. 配置
创建配置文件 ~/.openclaw/apps/deadornot/config:
bash
NOTIFYEMAIL=youremail@example.com
MESSAGE=用户无响应,请查看其状态!
TIMEOUT_HOURS=24
ASK_HOUR=10
SMTP_SERVER=smtp.qq.com
SMTP_PORT=465
SMTPEMAIL=yourqq@qq.com
SMTPPASSWORD=yourauth_code
3. 设置定时任务
bash
crontab -l | { cat; echo 0 0 * /path/to/check.sh >> /path/to/log.txt 2>&1; } | crontab -
配置说明
| 变量 | 默认值 | 描述 |
|---|
| TIMEOUTHOURS | 24 | 无消息后触发检查的小时数 |
| NOTIFYEMAIL |
- | 紧急联系人(必填) |
| MESSAGE | 用户无响应! | 邮件内容 |
| ASK_HOUR | 10 | 询问时间(0-23) |
| SMTP_SERVER | smtp.qq.com | SMTP 服务器 |
| SMTP_PORT | 465 | SMTP 端口 |
| SMTP_EMAIL | - | 发件邮箱 |
| SMTP_PASSWORD | - | SMTP 授权码 |