Question

I have a web application scoped feature that creates and submits a one-time timer job when the feature is activated. The purpose of the timer job is to copy a file from one directory to another on the file system of the machine running the job. The job should run on all WFE's in the farm.

Is it possible to programmatically check whether the file was successfully copied on all of the (remote) WFE's after the job completes? I find that even if the timer job claims to have successfully completed, the file may not have been copied on ALL servers.

For instance, I find that in some cases it is necessary to clear the SharePoint configuration cache on one or more servers before the timer would will successfully complete (cf. http://blogs.msdn.com/b/josrod/archive/2007/12/12/clear-the-sharepoint-configuration-cache-for-timer-job-and-psconfig-errors.aspx). Ideally, if that happens, I'd like to be able to tell the user (from an .aspx page) that the job failed to execute on one or more servers.

Was it helpful?

Solution

You could just use some error trapping in your code to determine if it completed or not. If it fails to find the file or fails to copy it, you should be able to detect that.

If I may ask a question though; is there a reason why you're doing this as a timer job, instead of just doing it in the feature receiver of the feature? I'd think you should be able to do it within the feature receiver giving you much more current status to relay to the user.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top