在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 exactname 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
相关文章推荐
- PHP创建Windows计划任务及At命令的简单介绍
- 用ASP.NET(VB)创建WINDOWS 2000/2003 SERVER站点
- vs2010 创建windows服务( Asp.net(C#) windows 服务 用于实现计划任务,事件监控等)
- Windows Server 2003 计划任务创建说明
- 创建Windows计划任务的2种方法
- Windows命令行创建计划任务
- Windows中MySQL自动备份和Windows的计划任务创建
- 创建windows计划任务
- C# 用TaskScheduler.dll 创建 windows任务计划
- 创建windows计划任务
- windows 2003 普通用户 计划任务 拒绝访问
- 使用计划任务实现Windows 2003上版本控制系统的自动备份
- 如何创建Windows网络计划任务
- Windows任务计划创建计划,定时执行PowerShell命令
- 创建windows计划任务
- vs2010 创建windows服务( Asp.net(C#) windows 服务 用于实现计划任务,事件监控等)
- windows Server 2003服务器上创建任务计划出现任务计划创建失败,显示密钥集不存在错误
- Windows下创建定时计划任务
- Oracle 自动备份 windows 任务计划, 创建表空间,打开1521端口,安装错误解决
- 【Windows】创建任务计划