您的位置:首页 > 其它

在Windows 2000/2003集群上创建任务计划

2008-12-01 15:20 218 查看

How to create a scheduled task within a Windows 2000/2003 Cluster

You have a need to run a procedure on the active node within a cluster. This procedure needs to occur at the same time each day. This procedure needs to run only on the active node for a given group. You are not alone; this is a very common request. The not so easy answer is below.

Modify Scheduled Jobs default location on all nodes

By default the scheduled job information is located in %systemroot%/tasks[/i] subdirectory. To work within a cluster the location needs to move to the shared disk.
Modify the following registry key so that the tasks folder location is pointed to the tasks subdirectory on the shared disk.
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/SchedulingAgent[/b]

This key has the following value: TasksFolder reg_expand_sz
%SystemRoot%/Tasks[/b] (change this path to task directory on the shared disk, I suggest you create a dedicated directory)
NOTE: There may be an issue performing the work and test from a terminal server session as the jobs may initially fail. Log off and back on terminal server (see KB 232276) and then the jobs will work.

Create the task on the active node in the cluster:

Go to Start-> Control Panel -> Scheduled Tasks -> Add Scheduled Task[/b]. Follow the prompts, for Application use the path to the batch file or program. Make sure you store the batch file or program on the shared disk.

Create a resource within the cluster:

1. Go into HKLM/SYSTEM/CURRENTCONTROLSET/SERVICES[/b] and write down the exact
name of the service as it shows in the list as you will need this for later. In this case it will be Schedule[/b], but you could use this process for any service.

2. Go into Cluster Administrator and highlight the group you want to put this in and then right click on the group and choose New[/b] and Resource[/b].

3. In the Name[/b] box, input whatever you want shown in Cluster Administrator, in the Description[/b] box, put whatever you want if anything or leave it blank, for the Resource Type[/b] field, choose Generic Service, [/b]in the Group field, it should already have the group you want [/b]and click Next.[/b]

4. Make sure that all the nodes are listed as Possible owners[/b] and choose Next[/b].

5. For dependencies, add the Disk[/b] and the Network Name[/b] and choose Next[/b].NOTE:[/i][/b] The Task Scheduler Generic resource must also be setup with a dependency on the physical disk and network name to prevent the resource from starting before the other resources are online. [/i]

6. For the Service Name field type Schedule[/b], (or exactly what you wrote above for the name of the Service if different). If it does not identically match, the service will fail to come online. For the Startup Parameters type %SystemRoot%/System32/svchost.exe -k netsvcs [/b](you would normally leave this blank. If the Service requires any parameters, it is generally in the registry for the service) and select the Use Network Name[/b] check box and choose Next[/b]. [/b]

7. For the registry key, go ahead and add[/b] the complete exact path to the registry. HKEY_LOCAL_MACHINE is a given, so you would use SOFTWARE/Microsoft/SchedulingAgent [/b]and then click OK[/b] and then Finish[/b].You can bring the resource online at this point. The Task Scheduler is changed from Automatic to Manual during the above process. If it is not, ensure that every node has the service set to manual.[/i][/b]

Important Note for the remaining node(s):

The security credentials for each job are contained in the Protected Storage Database on the local node and not with the job. So in order for a job to work on all nodes you need to refresh the credentials of the job on each node. To do that, create the job on first node, set the credentials.
Move the generic service resource to the 2nd node and enter the credentials for the job again. This issue is discussed in the following KB 317529 – Scheduled Task Does Not Run When You Push It to Another Computer.

Published Friday, May 25, 2007 4:56 PM by clustering
Filed under: Windows Server Clustering, ClusterHelp.com

http://msmvps.com/blogs/clustering/archive/2007/05/25/how-to-create-a-scheduled-task-with-a-windows-2000-2003-cluster.aspx
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: