A Publish script can be scheduled to run at set times using the scheduler.
Scheduled publish events are configured in an XML file which must be located in a certain location. For a specific project, this location is:
Here is a basic example of configuration file:
<schedule> <event> <start datetime="2010-07-15T07:00:00+10:00" /> <repeat minutes="4" until="2010-07-15T10:00:00+10:00" /> <target name="create-comment"> <description>Create Comments</description> <param name="folder-name" value="tutorials" /> <param name="max-size" value="10" /> </target> </event> <event> <start datetime="2010-07-14T00:00:00+10:00" /> <repeat days="1" daysofweek="mon,tue,wed,thu,fri" until="2010-08-14T00:00:00+10:00" /> <target name="generate-summary"> <description>Produce Daily Summary</description> </target> </event> </schedule>
In the previous example, two events are added to the scheduler. When these events are run, the project corresponding to the configuration file is published. That is to say, there is no document being published, only the group parameters are sent to the Ant script (see PageSeeder's Publish parameters for more information).
A publish event must have a
description. Optional fields of the events are: a
repeat frequency and a list of
Repeat frequency is defined by a repeat interval unit (only one of three are allowed:
@days) and the value of the interval. An optional
@until attribute is the end datetime for the repeat field.
@daysofweek attribute restricts the event to run on the days listed and requires a repeat interval of 1 day or less.
Here are examples of repeat frequencies:
<repeat days="7" /> <repeat hours="24" until="2010-12-31T00:00:00+10:00" /> <repeat minutes="15" /> <repeat days="1" daysofweek="thu,fri,sat,sun"/>
Params are the parameters sent to the Ant script, there can be as many as needed.
The corresponding ANT script must be on the ps-publisher in the following location and contain targets with the names specified in the
A jsession ID is not available to the publish script so it needs a username and password to access PageSeeder. These can be supplied using the
<ps:config> task as follows:
<ps:config file="pageseeder.properties" />
with the following file
pageseeder.properties in the same folder as the
When a password is in a file like this it is more secure to configure it as an API account in case someone gets a copy of the file. API accounts can only access PageSeeder from specified IP addresses and can be configured by adding the following properties for example to the
View publish script logs
After configuring the script on the Publish scripts page located under Templates in the Administration menu, click the refresh button at the top right of of the table of publish scripts.
You can now edit the script or click open folder to go to the Template files page.
To view the publish logs, go to the System administration menu > Logs > Publish logs (system page).
Testing and pausing scripts
Go to the Publisher page on the Administration menu > System administration > Server status > Publisher.
All the publish jobs running on the server are listed—each job can be monitored and canceled. The cancel button is used to send a request to cancel the job.
All the scheduled jobs for the server are also listed, along with their configured details, which can be useful for debugging. The refresh button is available to load any modifications in the configuration file.
They can be tested without waiting for the scheduled time—click the Run now button to test or Pause/Continue if required.