I would like to setup a SQL Server agent job to run every 3 seconds, but I found that the minimum frequency is 10 seconds.
Then I try to setup multiple schedules, such that first schedule starts at 00:00 (run every 10 seconds), second schedule starts at 00:03 (run every 10 seconds), third schedule starts at 00:06 (run every 10 seconds).
But the second schedule and third schedule never runs, I have googled that the sql server agent job needs 5 seconds idle time before the next schedule starts
Is there any idea how I can set the sql server agent job to run in every 3 seconds?
Thanks.
you can write this in a step and it will do something you want to in every 3 sec while job runs
while 1=1
step which you want to execute
waitfor '00:00:03' --3 sec
Related
Is it possible to execute a Cron job such that between certain hours, it executes every 30 minutes, but other hours, only every 1 hour?
I was unable to figure this out using my basic Cron abilities.
I am using cron and I need to schedule my workflow, so that it runs every day hourly, just except 2 hours from 12 AM until 2 AM. Meaning it needs to run daily from 2 AM and kick off every hour, but just when the clock hits 12 AM it should't run for 2 hours. And then starts back at 2 AM to run every hour.
Would appreciate a solution.
This is a CRON job
0 0 2-23 ? * * *
Description: Job will start at second:00, at the minute:00, every hour between 02 am and 23 pm, of every day
I have found this website useful to create CRON job
For example, if I have a cron job that I want to run every 9 hours:
0 */9 * * * my_script
The job is executed at 00:00, 9:00, and 18:00; and then the same hours the next day.
What I want is for the job to execute at 00:00, 9:00, 18:00; then 03:00, 12:00, 21:00 the next day -- a true "every 9 hours".
Is there any way make cron job run EVERY 9 hours?
Specifying */9 means that the job runs every 9 hours starting at 00:00. It starts again at 00:00 every day.
There is no syntax in cron to run a job every 9 hours.
What you can do is run a job every 3 hours, and have the command itself examine the current time and only execute 1 time out of 3. Or it can run every hour and execute one time out of every 9. Don't assume that the current time will be exact; it might run a few seconds after the hour.
I am dealing with a workflow where I need to start three processes. I have the first process which is to be scheduled at the beginning of every hour and the rest two at 45th minute of every hour and the 52nd minute of every hour.
But Instead of making the client schedule two different jobs on their server what I would rather want is to have just one job configured to run in the beginning of every hour which does a bunch of stuff and then starts these cron jobs at their respective times. i.e. 45th minute and 52nd minute of the hour.
Is there any way to do this.
I don't have any experience with shell scripting and always schedule cron jobs manually on cron-tab.
Thanks!
I have a cron job that processes an action for several records in my database. I want it to process each record with a 5 minute delay, then repeat the process every 12 hours. What is the syntax that I need to use to make this happen? For example, if I have 5 rows in my database that the cron job will process. I want it to process the first row, then process the next row 5 minutes later, then process the next row 5 minutes later, etc. until all rows have been processed. Then repeat the whole process every 12 hours. I tried using */5 */12 * * * but it did not work.
It won't work the way you have configured.
if I have 5 rows in my database that the cron job will process. I want it to process the first row, then process the next row 5 minutes later, then process the next row 5 minutes later, etc
Write a shell scrip to achieve above goal. Cron won't do it for you. Hint: use sleep function in your scrip to wait for 5 minutes before processing next record.
Then repeat the whole process every 12 hours
use * */12 * * * in cron to let your shell script run after every 12 hrs.
So, in short, Cron will trigger a run of you script very 12 hrs AND your script has the logic to wait for 5 minutes between processing any two consecutive DB records.