I am trying to look for cron expression to schedule a job every alternate Mondays at 12 PM. I am using Rundeck to schedule my jobs.
How do i create an expression that runs a job like this ?
1st Run => 01-July-2019 [Monday] 12:00 PM
2nd Run => 15-July-2019 [Monday] 12:00 PM
3rd Run => 29-July-2019 [Monday] 12:00 PM
You need another "verifier" job (using Rundeck API) that modifies the first at every alternate, here you have a good example: https://github.com/G3NSVRV/Rundeck-Scripts/tree/master/ProjectExamples/ConditionalCron (take a look from line 39 to 50 in "Cron.xml" file).
Related
In salesforce is there any way to run the Batch Job midnight at EST time everyday ?
I know following cron runs everyday at 1:00 AM. But not sure on which timezone will it run ?
Cron format ==>
0 0 1 1/1 * ? *
I dont see a way to configure the timezone actually. Any way ?
System.schedule('TSAMPLE Job1', '0 0 1 1/1 * ? *', new My_Scheduler());
Like mentioned here:
Apex Scheduler the The System.Schedule method uses the user's timezone for the basis of all schedules.
Hope this helps.
Im having some difficulty with this cron job. Running a job at 6:15PM every otherTuesday during March, June, September and December
What I have so far 15 18 1 3,6,9,12 2
Have a cron schedule for every Tuesday, and then make sure in the command that it only runs every other time. For example, we can use the date command to get the number of the week, so we can check if that week number is even.
15 18 * 3,6,9,12 2 [ $((`date +%V`%2)) -eq 0 ] && your_command
(untested)
I have a console/executable app which I need to configure in autosys which will run every week on Sunday at 12 AM.I have never used autosys. Any help or link will be helpful related with jil command.
insert_job: JOB_NAME job_type: c
box_name: BOX_NAME (if you use one)
machine: servername
owner: account /(which will run the job, must be permissioned on the machine)/
command: whateveryouwanttorun
condition: s(previousjob) /(Means run only if previousjob is in succes state)/
description: "Description Here"
date_conditions: 1 /(1 or y for yes, 0 or n for no)/
starts_time: 00:00 /("00:00" also accepted)/
days_of_week: su
alarm_if_fail: 1 (1 or y for yes, 0 or n for no)
std_out_file: >>path\filename.log
std_err_file: >>path\errorfile.log
There are lots of other options you can invoke like use of a profile or adding variables or dates to log names etc etc. For an explanation of any of these you can ask back here or check google or ca.com for the user guide for the version of AutoSys in use at your place (commonly 11.0 or 11.3.n or possibly 4.5).
Good Luck!
I know, there are many contents about cronjob. But i'm uncertain.
I need a Cron that run all 5 minutes. This Cron shouldn't run between 00:00 and 01:00 (in the night)
My cron
*/5 01-23 * * * balbalabalabal > aaa
Is this right?
Running this cron at 23.05, 23.10....23.55 and start again at 01:00?
best regards!
Ok I tested this.
The Cron runs at 23.05, 23.10..... until 23.55.
Then pausing and the first Cronjob start again at 01.00
I have the following few lines in a batch file:
#echo off
echo Running dump...
"D:\wamp\bin\mysql\mysql5.5.16\bin\mysqldump" --host="localhost" --user="****" --password="****" database> "D:\wamp\backup\mysql\"back.%date:~0,2%.sql
echo Done!
Supposedly, it should create a backup file with today's day as 01, 02, 03, ..., 31, that is,
back.01.sql
back.02.sql
back.03.sql
When I run it from CMD, it actually creates it as expected, but when it is run from the scheduler it looks like:
back.Mo.sql
back.Tu.sql
back.We.sql
What date format should I use to ensure it actually created with number of the day of the month?
Working with dates and times in Windows batch is a pain.
The most robust solution is to use WMIC to get the local date and time. It returns a value in the following format:
YYYYMMDDhhmmss.dddddd-ttt
YYYY = year
MM = month
DD = day
hh = hour in 24 hour format
mm = minutes
ss = seconds
dddddd = fractional seconds
ttt = time zone (minutes difference from Greenwich Mean Time)
So you can use the following to get the current day of the month in a variable
Edit - corrected starting substring location from 7 to 6
set curDate=
for /f "skip=1" %%x in ('wmic os get localdatetime') do if not defined curDate set curDate=%%x
set day=%curDate:~6,2%
The big advantage of this technique is it will work on any Windows machine in the world, regardless of the locale settings.
Here is your code with the technique inserted
Edit - corrected starting substring location from 7 to 6
#echo off
echo Running dump...
set curDate=
for /f "skip=1" %%x in ('wmic os get localdatetime') do if not defined curDate set curDate=%%x
set "day=%curDate:~6,2%"
"D:\wamp\bin\mysql\mysql5.5.16\bin\mysqldump" --host="localhost" --user="****" --password="****" database> "D:\wamp\backup\mysql\back.%day%.sql"
echo Done!
Just setup regional settings dd.MM.yyyy for the account under which your task is run. (use control panel or registry HKCU\Control Panel\International\sShortDate for Windows XP at least.