opsxcq / tasker

Tasker is a multipurpose task runner
195 stars 17 forks source link

Start or Stop Option #7

Open patoperpetua opened 5 years ago

patoperpetua commented 5 years ago

Hello, I don't know if there is a feature to stop a container. My idea is to start a container at certain time and stop it at another. I can start a container a certain time using cron but i cant find the way to stop it.

By the way, really cool your tool, I have it setup in one of my servers

bazarnov commented 3 years ago

Hi, you can play with cron jobs with " not to start the cron job " at certain time. Give more information about the execution period you need or try to play with this resource in order to have strict cron job execution, a.k.a: "Start at this time, and not start at that" regarding your task of course.

https://crontab.guru/

EXAMPLE:
NOW: 2021-02-03 13:28 CRON SCHEDULE: 0 /2 1-14 * CRON DESCRIPTION: At minute 00, past every 2nd hour on every day-of-month, starting from 1 through 14th. NEXT CRON JOB: at 2021-02-03 14:00:00 then at 2021-02-03 16:00:00 then at 2021-02-03 18:00:00 then at 2021-02-03 20:00:00 then at 2021-02-03 22:00:00 and so on till 2021-02-14 00:00:00 comes.

So, theoretically you can start and stop the container using cron jobs at certain time as you need. Hope that helps.