Cron 作業不工作 (CURL)

Cron 作業不工作 (CURL)

我有一台使用 Linux 19.04 的伺服器

首先我做了:nano /etc/crontab

以下內容已經在文件中

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
13 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
18 00   * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
33 00   * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
43 00   1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#

#我在行前最後添加了這個

*/1 * * * * curl -s "https://www.example.com/abc" > /dev/null

答案1

我不知道這個文件是否是為此目的而製作的,我通常使用標準的 cron 功能來定期運行作業,但也許這是可能的。但是,正如你所看到的,這個文件中有一個用戶字段,所以你也應該填寫它,之後,可以肯定的是,喲,你應該重新啟動 cron:

sudo systemctl 重新啟動 cron.service

相關內容