Like many of your questions this is very general and you’ve not provided any examples of what you’ve tried to solve this on your own. Repeatedly asking for code from other people is disrespectful of their time. I’d encourage you to spend some more time experimenting yourself and thinking about asking better questions.
Chef isn’t geared toward one off changes like this but you could use it in conjunction with say
cron to set something like this up.