How to set up a cron job in Itamae

Asked 1 years ago, Updated 1 years ago, 75 views

I wanted to set the cron in Itamae, but there were no cron resources and there was no documentation on what to recommend, so I looked at the Twitter tweets and set the following job under the name.d/my_task.

15*** echo hoge>/var/log/hogehoge.txt

Can't cron.d automatically load files in cron.d?

Also, is it better to define resources for cron by yourself like This site

?

When I wrote what I tried, the question got a little distracted, but what I want to know is, "How do I set cron in Itamae?"

itamae provisioning cron

2022-09-29 22:56

2 Answers

It may not be a good idea, but I am rewriting the cron entity file.

template "root cron set" do
    path"/var/spool/cron/root"
    source "templates/var/spool/cron/root.erb"
    owner "root"
    group "root"
    mode "644"
end


2022-09-29 22:56

/etc/cron.d/ The following is the system cron configuration, and the running user must be listed.This is what the man of crontab says in the following parts:

Each line has five time and date fields, followed by a user name if
This is the system crontab file, followed by a command.

Crontab is looking for a user named echo.With this setting (if you want to run it on root), you should write /etc/cron.d/my_task as follows.

15***root echo hoge>/var/log/hogehoge.txt


2022-09-29 22:56

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.