Scheduled tasks in Admin

Hi,

We are trying to trigger a robocopy process once a publishing run has finished. This will copy the published files to another server but rather than doing it throughout the day we want to only do it after the publishing run.

We have experimented with the email notification (for publishing runs) and that worked ok. We simply added on a call to the Robycopy.exe program on the RX server. The task log reported no errors but the copy didn’t happen so not sure what we are doing wrong. We received the email but the task command line was included in the email text.

The code we used in Admin > Task Notifications > Run_Edition_Template

Subject:


if ($sys.completed) 
{'Publishing of the Edition ' + $sys.editionName + ' was completed successfully.';}  
else 
{'Publishing of the Edition ' + $sys.editionName + ' failed to complete';}

Template:


Site: $sys.siteName

#if ($sys.completed)
Success Count: $sys.successCount
Failure Count: $sys.failureCount

Runtime.getRuntime().exec("cmd /C:\Program Files\Windows Resource Kits\Tools\robocopy.exe" \\pub-server-name\E$\webfolder\website_name \\copy-server-name\E$\webfolder\website_name /mir");

#else
The problem was: $sys.problemDesc
#end

Starting Time: $tools.date.format("yyyy-MM-dd HH:mm:ss", $sys.executionDatetime)
Elapsed Time: $tools.number.format("00", $tools.math.div($sys.executionElapsedTime,3600000)):$tools.number.format("00", $tools.math.div($sys.executionElapsedTime,60000)):$tools.number.format("00", $tools.math.div($sys.executionElapsedTime,1000))

Log URL: $sys.editionLogUrl

Can anyone advise?

Thanks

Chris

Chris,

The Notification generates the e-mail that is sent when the publish is complete. It does not run any processes.

You need to create a post-Edition task to run Robocopy.

RLJII

Hi,

What is a post-Edition task? Is this the default Task Notification template found in the Admin console.
Is it correct to use the java syntax to run the robocopy script in the velocity template?

K

In the [I]System Administration Manual[/I] (Version 6.7 link), see “Maintaining Schedules”, pp. 21-38, in particular, “Scheduled Tasks”, pp. 22-27.

No. See the text cited above.

As I stated earlier, the Notification only generates an e-mail. While it resolves the Velocity macros, it will not run code. To run the code, you need to create a task.

RLJII

Read the manual.
What is a post edition template. Cannot find any mention of it.

You can create a scheduled task with the sys_runCommand…is that it?

Rathere than drag this out to infinity, this is what I would like to do:

When a publishing run finishes I would like to know that it has (the notification template runs).Then I would like robocopy to run and only run at the end of the completed publishing run.

Thanks

[QUOTE=kyrryk;16592]Read the manual.
What is a post edition template. Cannot find any mention of it.

You can create a scheduled task with the sys_runCommand…is that it?

Rathere than drag this out to infinity, this is what I would like to do:

When a publishing run finishes I would like to know that it has (the notification template runs).Then I would like robocopy to run and only run at the end of the completed publishing run.

Thanks[/QUOTE]

I pointed you to the wrong documentation. Instead you should look at “Creating Editions” pp. 330-337 to in the Implementation Guide. Specifically, see the example of creating post-Edition tasks in Step 10 of “Full Publish Edition” (pp. 332-333).

To do what you want:

[ol]
[li]Modify your Edition by adding a post-Edition task that runs robocopy, as described in Step 10 as cited above. This task will run immediately after publishing of the Edition is complete, whether the Edition is run manually or automatically as a scheduled task.
[/li][li]Create the Notification (which you have already completed).
[/li][li]Create a scheduled task to run the Edition. The details about defining the scheduled task are outlined in the documentation I cited in my previous response to this thread. Associate the Notification with the scheduled task.
[/li][/ol]

I did notice an unresolved cross-reference in Step 10d of the topic “Full Publish Edition”. The reference should be to the chapter “Extensions”, p. 179 in the Technical Reference.

Many thanks. I will give that a go.