use whenever gem to setup biweekly cron job - cron

Is there anyway to schedule cron jobs using whenever to run every two weeks, meaning first Saturday of the month and the third Saturday of the month.

How about the following:
require 'activesupport'
every :saturday do
month_day = Date.today.mday
if (1..7).include?(month_day) || (15..21).include?(month_day)
# YOUR TASK
end
end

Related

How to schedule a Cron job for multiple days every month?

I wish to schedule a airflow job for specific set of dates every month, for example 11th and last day of every month and used the below scheduler expression
25 14 11,L * * # At 2:45 pm on 11th and last day of every month
When I validated the above in https://crontab.guru/ and http://cron.schlitt.info/ i was told the expression as invalid.
Is it possible to schedule together for a known and a unknown (here last) day of every month? If not is there any other way to achieve this?
maybe your cron does not support the "L" flag. you can refer to this CRON job to run on the last day of the month

Odoo12 Cron Jobs Execute on specific days

I have written cronjobs in odoo12 and I want them to execute 6 days in a week with exemption of sundays since sunday is not a working day, how can i do that in odoo12/odoo11
You can do one thing run cron everyday but while executing the function you can skip there put condition there of not executing your function on sunday.

cron expression for quartz to start on particular month and repeat every months onwards

I am working on Quartz Scheduler where need to trigger my job on basis of monthly where user can select desired month date from which he want to make it run for every month on that particular date. lets say- I want to schedule quartz job from August 20,2015 which should run every month on 20th, but it should not start by today,must be start on August 20,2015 onward. what would be the cron expression for this?
I have tried a lot to find out the matching thread but did not worked for me.
like if i have to make for every month which start on 20 May 2015 and repeat every 20th date of month the cron expression would be [0 0 12 20 1/1 ? *].for this requirement lot of things available around and works nicely. but how to schedule Quartz which must fire on particular date and repeat onward for every month on that particular date and time?
Please help me out.any link or any guideline would be appreciable.

Cron Job every second week day

I need a cron job to run every second weekday for example
If cron job last ran on a Thursday it should run on the next Monday
The re-run on Wednesday and again on Friday again and on Tuesday and again on Thursday bring it back to the start.
Thanks
Run it every weekday, and have the script set a flag in a file that says whether it did the work the on the previous run. If it did, it skips the work that time and inverts the flag.

run cron job on end of every month

I need to run a script at 2 pm on the end of every month. The reason i set 2 pm is i've a timezone of asia/calcutta and it differs 10 hrs and 30 min. from the server time.
I've set date_default_timezone_set('Asia/Calcutta') in my script, so for the current settings i can trigger 1st day of every month as per my timezone.
But the issue is, i'm using webmin and there is no settings to run end of every month and only date from 1 - 31 listed. Here i attached the screenshot.
How can i run the script on end of the every month at 2pm?
Any help greatly appreciated, Thanks!.
The simple way, but ugly
is set to run on every 28,29,30,31 days. Each time when script is launched compare current day with max days in current month using bash/oerl script
Have it run every day starting the 28th of every month through the first of the next month. In the script, check if tomorrow is the first day of a month. If so, run, else die.

Resources