Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

钉钉机器人配合 crontab定时发送消息 #27

Open
daisybaicai opened this issue Apr 22, 2020 · 0 comments
Open

钉钉机器人配合 crontab定时发送消息 #27

daisybaicai opened this issue Apr 22, 2020 · 0 comments
Labels

Comments

@daisybaicai
Copy link
Owner

钉钉机器人基本使用

  • 首先需要创建机器人
  • 最基本的只发送文字,通过curl调用接口即可,如下
#!/bin/bash

curl 'https://oapi.dingtalk.com/robot/send?access_token=xxx' \
   -H 'Content-Type: application/json' \
   -d '{
    "msgtype": "text", 
    "text": {
        "content": "【提示】dingshi-shell-curl"
    },
}';

定时任务的执行

  • mac下需要打开crontab :sudo crontab -e
  • i 进入输入模式
  • 写入定时命令
    【每天的 21点05分执行shell脚本】
05 21 * * * sh /Users/daisiyao/Desktop/boi/2.sh
  • 需要删除的定时任务就通过sudo crontab -r

效果

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant