Use crontab -e
to add a new scheduled task, as follows:
*/1 * * * * /usr/bin/curl http://xxxx.com/api/sendmsg
Later, it was found that the above is a get
request, but the post
interface cannot be requested, so I tried several methods in the background, and found that the interface can be called correctly as follows,
crontab
executes the request for the interface every one minute.
*/1 * * * * /usr/bin/curl http://xxxx.com/api/sendmsg -X POST
It is safer to use the post
method for the interface! Hope to give you some help!