Linux (Fedora) scheduler that supports repeat so often - scheduled-tasks

Not that I have much experience with crontab but I understand it is not possible to schedule jobs to run every X time units (e.g. run every 30 min) but the exec times must be specific.
Does anyone know of a scheduler that supports this functionality and can run out of a command in the background, better yet out of systemd as a service? And that is free, of course (so no Autosys and such).
e.g. Ktimer on Fedora can do repeats but it is not a service, does not have CL, and the app actually must be open in order to run tasks. so it doesn't cut it...
Thanks

actually, it can be done via crontab:
0,20,40 * * * *
runs it every 20 min

Related

How to make cron job start after x seconds?

I think I am misunderstanding Kubernetes CronJobs. On the CKAD exam there was a question to have a CronJob run every minute, but it should start after an arbitrary amount of time. I don't see any properties for CronJobs or Jobs to have them start after a specific time. Should that be part of the cron string or am I completely misunderstanding?
You could do something like
#reboot sleep 60 && script.sh
though you don't mention boot time specifically. You can also add sleep to the crontab.
Another way is to create a systemd service (note: on systems with systemd installed)
[Unit]
Description=cronjob with delay
After=(some criteria)
[Service]
Type=oneshot
ExecStart=/pathto/script.sh
[Install]
WantedBy=
You can schedule your CronJob to start at specific date/time and than run every minute or however you would like to set it. There is a powerful online tool that can help you with it. For example:
0 0/10 10/1 ? * * *
will schedule your CronJob to run every 10 mins starting at 10h of the day. Or:
0 0/10 * ? * 6/1 *
will schedule your CronJob to run every 10 mins starting on Friday.
The important thing to keep in mind while using this particular approach is to be aware of the timezone that your cluster is running in:
All CronJob schedule: times are based on the timezone of the
kube-controller-manager.
If your control plane runs the kube-controller-manager in Pods or bare
containers, the timezone set for the kube-controller-manager container
determines the timezone that the cron job controller uses.
More info/examples about scheduling can be found below:
Cron schedule syntax
Running Automated Tasks with a CronJob
maybe you misunderstood the question, it was to terminate the job if it didn't complete in x seconds. you should use the .spec.activeDeadlineSeconds to satisfy the requirment.
you could do
sleep "seconds"; echo " * * * * * command" >> path/to/crontab
I feel like maybe the question is worded incorrectly. It probably meant something like every minute on every Saturday day.
* * * * SAT
Or every minute through range of hours
* 9-17 * * *
https://crontab.guru/examples.html

Is a crontab enough to schedule a celery task to run periodically?

I have a periodic task that uses a crontab to run every day at 1:01 AM using
run_every = crontab(hour=1, minute=1)
Once I get my server up and running, is that enough to trigger the task to run once a day? Or do I also need to use a database scheduler?
Yes. It should be enough as Celery beat has own state file that is enough to run everything as you require.

Running very lightweight tasks periodically with kubernetes

Consider a requirement where we need to run very simple and lightweight tasks , say running curl command every 10 minutes.
If this was to run in a kubernetes cluster , is it efficient to create a container every 10 minutes ? Just to execute a task that may take a few seconds or even millisecond ? Is it an overkill from time and cost angle ?
Please note unfortunately lambda functions or cloud functions is not an option.
You can use a CronJob to run Jobs on a time-based schedule. These automated jobs run like Cron tasks on a Linux or UNIX system. Cron jobs are useful for creating periodic and recurring tasks.
https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/

why there is several crond process on centos OS

I have a server which CPU usage is very high, and I find there is many crond process on this server. I can not understand why this occur.Anyone know the reason? Please tell me.
When I run "ps aux | grep crond" on this server.
enter image description here
crond forks a process for each job it executes. In your case, it looks like several jobs are being started every five minutes. All of them, though, appear to be waiting for I/O (that's the meaning of the "D" process state in the 8th column of ps output, according to the ps man page), and thus are not contributing to CPU load.
If you want to know what's eating the CPU, start with top.
crond is not the cause of the problem, suggest you use top to check Cost the process of high performance.

Chronos + Mesosphere. How to execute tasks in parallel?

Good day everyone.
I have single server for Chronos, Mesos and Zookeeper, and i want to use Chronos as something, what will run my scripts daily. Some scripts today, some tomorrow and so on..
The problem is when i'm trying to launch tasks one after another, only first one executes correctly, another one is lost somewhere. If i launch first then take a pause of 3-4 seconds and launch another - they both are launched, but sequentially.
And i need to run them in parallel.
Can someone provide a hint on this? Maybe there is some settings that i must change?
You should set a time in UTC time for both tasks to be launched with a repeating period of 24 hours. In this case, there is no reason why your tasks should not execute in parallel. Check the chronos logs and the tasks logs in sandbox on mesos for errors.
You can certainly run all of these components (Chronos, master, slave, and ZK) on the same machine, although ZK really becomes valuable once you have HA with multiple masters.
As user4103259 suggested, check the master and slave logs for that LOST/failed taskId to see what exactly happened to it. A task could go LOST/failed for numerous reasons, anywhere along the task launch/running/completing process.