Scheduling a task to run at the end of every month. (Windows Server 2003 - Scheduled Tasks) - windows

I need to schedule a task to run on the last night of each month, on a Windows 2003 Server.
I see that you can schedule it to run on the "first or last Mon-Fri", or even on the nth day of each month - but, not how to get it to run on the last day (regardless of day of the week or number).
Thanks in advance.
Note: I did check "How do you schedule tasks in Windows?", etc...

Looks like you have to set up multiple schedules for your task. One schedule for the months with 31 days, another for those with 30, and one more for February. See this: http://support.microsoft.com/kb/936627

I do it a little differently - I run one task every day but since the task is in vbscript - I do this:
DIM datecur, datefut
datecur = DATEPART("m",NOW())
datefut = DATEPART("m",NOW()+1)
If (datecur <> datefut) then
'insert code you want to run here
end if
Simple and it works - hope this helps someone

As of November 2022, much newer Windows version (2019)
I see this option in Triggers:
WinScheduler Task Triggers
Begin the task: On a schedule
Settings:
Monthly
On: Last > then select All weekdays

Related

What is "INTERVAL=0" means in Oracle Schedular?

My Oracle DBA have setup a task with following repeat_interval:
Start Date :"30/JAN/20 08:00AM"
Repeat_interval: "FREQ=DAILY; INTERVAL=0; BYMINUTE=15"
Can I ask what is "Interval=0" means?
Does it means this task will run daily from 8AM, and will repeat every 15 mins until success?
I tried to get the answer from Google, but what I find is what is Interval=1, but nothing for 0.
So would be great if anyone can share me some light here.
Thanks in advance!
INTERVAL is the number of increments of the FREQ value between executions. I believe in this case that a value of 0 or 1 would be the same. The schedule as shown would execute once per day (FREQ=DAILY), at approximately 15 minutes past a random hour (BYMINUTE=15, but BYHOUR and BYSECOND are not set).
Schedule has nothing to do with whether or not the previous execution succeeded or not. Start Date is only the date at which the job was enabled, not when it actually starts processing.
If you want it to run every 15 minutes from the moment you enable it, you should set as follows:
FREQ=MINUTELY; INTERVAL=15
If you want it to run exactly on the quarter hour, then this:
FREQ=MINUTELY; BYMINUTE=0,15,30,45; BYSECOND=0
If you want it to run every day at 8am, then this:
FREQ=DAILY; BYHOUR=8; BYMINUTE=0; BYSECOND=0

Installing windows update after patch Tuesday

The Saturday after each patch Tuesday (which is the second Tuesday of the month), I want to install updates via Puppet. I made a scheduled task for this, itself managed via a scheduled_task resource from the puppetlabs/scheduled_task module. I am using this trigger for that task:
$trigger = {
schedule => monthly,
start_time => '13:15',
which_occurrence => second,
day_of_week => [sat],
minutes_interval => '80',
minutes_duration => '560',
}
. However, on months like this one, where the second Tuesday comes AFTER the second Saturday, this trigger launches the task on the wrong day. How can I make the task fire on the first Saturday following the second Tuesday of each month?
It might be possible to count the days after patch Tuesday, but this would require Puppet to be able to get the date of every second Tuesday of the month (which it can't AFAIK).
The puppetlabs/task_scheduler module manages tasks that are to be run via Windows' built-in Task Scheduler service. Puppet does not itself run the tasks; it just registers them with the system service and manages their properties. This is a problem for you, because as far as I can determine, the Windows task scheduler does not support the type of scheduling you're looking for. Of course, puppetlabs/scheduled_task cannot provide for something that the underlying OS does not support.
Your alternatives include, but are not necessarily limited to:
Choose a different schedule for your task. For example, schedule the task for the third Saturday of the month, which will always follow the second Tuesday.
Use an Exec to perform the update, with a combination of conditional logic and a Puppet schedule for controlling the date and frequency of application.
It is true that the latter requires Puppet to perform some date computations. Puppet can do that, but you would probably need to write a custom function (in Ruby) for that purpose. Custom functions are accessible during catalog building, and they can use substantially all the capabilities of Ruby.

Oracle-DBMS jobs scheduler change the start time

I have a DBMS_jobs which is scheduled to run a procedure FINDING_PROCEDURE at 6 am evey day. Can anyone tell me how can i change the start time so that it is scheduled to run at 9 am from tomorrow. Thanks in advance.
As I already mentioned in my comment - your job doesn't run at 6 am every day, it runs every 21 hours.
As a second remark, you should seriously consider switching to DBMS_SCHEDULER - it's so much nicer than DBMS_JOB.
Anyway, to let this job run at 9am every day, this should do the trick:
DBMS_JOB.CHANGE (
job => your_job_id,
interval => 'trunc(sysdate) + 1 + 9/24');
you can use DBMS_JOB.CHANGE() to Alter your job schedule.
Click on this link for complete reference from
Oracle Documentation:DBMS_JOB
and find DBMS_JOB.CHANGE()

run a script every 4 hours with task scheduler

I have windows 2008 task scheduler I set up a PHP script to run like this
C:\php\php.exe -f etc...
In windows task scheduler I can only schedule daily or hourly how can I configure it to run every 4 hours?
In Windows Server 2008/2008R2 you can set task to repeat every number of hours you want, corresponding drop down menu just present you with 1 hour option to select, but you can type in any number of hours you need (see screenshot below).
You could just set it up to run every hour, and at the beginning of the PHP script, check the current time, and exit if the current hour modulus 4 wasn't zero.
Where it says "repeat task every", you may also just be able to change "1 hour" to "4 hours" (it's not in the dropdown, so just type it in). You can do this in Windows 7, I'm not sure about Windows Server 2008.

Time based build scheduling in Teamcity

In Teamcity (version 7.1) how do I set up a build to be triggered to run every 20 mins for example?
I notice you can set up timed based schedules, for example "Run this build at 18:00 everyday" but that's not quite what I want.
You can use a Schedule trigger with cron expressions to do this.
I believe you'd need this one:
Seconds: 0
Minutes: 0,20,40
Hours: *
Day of month: *
Month: *
Day of week: ?
Year: *
(or whatever interval you desire)
TeamCity uses Quartz for scheduling, see more cron expression examples.
The cron expression you need is "0 0/20 * * * ? *"
See these cron expression examples
The the cron expression here:
Under the Build Configuration Settings
Triggers > "Add new trigger" > "Schedule Trigger"
Select "advanced (cron expression) from the "When:" dropdown
This is for TeamCity version: 2017.1.2
run every half hour
Hours set "*" - run every hour
Minutes set "0,30" - run every 0 minute and 30 minute
You can trigger builds using HTTP and so you could do what you are asking for by making such requests using your operating systems task scheduler.
http://confluence.jetbrains.com/display/TCD7/Accessing+Server+by+HTTP

Resources