How do I create a crontab through a script

前端 未结 12 1045
再見小時候
再見小時候 2020-11-28 01:36

I need to add a cron job thru a script I run to set up a server. I am currently using Ubuntu. I can use crontab -e but that will open an editor to edit the curr

12条回答
  •  孤城傲影
    2020-11-28 02:32

    In Ubuntu and many other distros, you can just put a file into the /etc/cron.d directory containing a single line with a valid crontab entry. No need to add a line to an existing file.

    If you just need something to run daily, just put a file into /etc/cron.daily. Likewise, you can also drop files into /etc/cron.hourly, /etc/cron.monthly, and /etc/cron.weekly.

提交回复
热议问题