Ok, it's time to do some maintenance and performance tuning on your Tridion CMS. One of the things you should keep an eye is the size of the Publishing Queue. This can grow quite large over time depending on the amount of publishing going on daily.
Tridion comes with a very handy tool -- the Purge Tool, which allows trimming the size of the Publishing Queue. I won't go into what the tool can do; there is documentation for that.
The following little script is perfect to run inside a Windows batch script and schedule it to execute periodically. In its current state it deletes Publish Transactions that completed more than 1 year ago relative to today's date.
For the worth, it cool noticing how ingenious the last year's date is constructed, then how the find and replace is taking place in the template file.
The batch script makes use of the following template file, which simply offers all default values for the purge job. The cutoff date is give by pattern XXX:
In order to execute the script, simply call the batch file from Windows command prompt or within a Scheduled Task. The script requires the environment variable TRIDION_HOME be set. Obviously, run the script on the Tridion CMS server.
Tridion comes with a very handy tool -- the Purge Tool, which allows trimming the size of the Publishing Queue. I won't go into what the tool can do; there is documentation for that.
The following little script is perfect to run inside a Windows batch script and schedule it to execute periodically. In its current state it deletes Publish Transactions that completed more than 1 year ago relative to today's date.
@echo
off
set
/a LastYear=%DATE:~10,4%-1
set
OneYearAgo=%LastYear%/%date:~4,5%
echo
OneYearAgo=%OneYearAgo%
echo
TRIDION_HOME=%TRIDION_HOME%
@echo
off > "%TRIDION_HOME%bin\purge.xml" & setLocal
enableDELAYedexpansion
for
/f "tokens=* delims= " %%a in (purgeTemplate.xml) do (
set str=%%a
set str=!str:XXX=%OneYearAgo%!
>>
"%TRIDION_HOME%bin\purge.xml" echo !str!
)
cd
"%TRIDION_HOME%bin"
PurgeTool.exe purge.xml /Purge
PurgeTool.exe purge.xml /Purge
For the worth, it cool noticing how ingenious the last year's date is constructed, then how the find and replace is taking place in the template file.
The batch script makes use of the following template file, which simply offers all default values for the purge job. The cutoff date is give by pattern XXX:
<XML>
<Settings>
<LoggingDirectory>C:\Tridion\log\</LoggingDirectory>
<LogFilePrefix>Purge_</LogFilePrefix>
<Items Purge="false">
<Keep>5</Keep>
<DaysToKeep>0</DaysToKeep>
<Recursive>0</Recursive>
</Items>
<ProcessHistories Purge="false" Before=""/>
<PublishTransactions Purge="true" Before="XXX">
<State Purge="true">Success</State>
<State Purge="true">Failed</State>
</PublishTransactions>
</Settings>
<Scan>
<Root Purge="False"/>
</Scan>
</XML>
</XML>
In order to execute the script, simply call the batch file from Windows command prompt or within a Scheduled Task. The script requires the environment variable TRIDION_HOME be set. Obviously, run the script on the Tridion CMS server.
Comments