Empty the Activities trash on a schedule
Edit configuration property settings to set up a schedule on which to permanently delete the activities and entries that have been moved to the Trash view.
Activities that are deleted are moved to the Trash view and can be restored from the Trash view. We can schedule the permanent deletion of activities and entries after a time interval specified. When the scheduled job runs, the activities and entries in the Trash view are permanently deleted from the system. Items that are purged from the Trash view are not recoverable.
To schedule the permanent removal of activities or entries from the Trash view:
- Check out the Activities configuration files:
./wsadmin.sh -lang jython
execfile("activitiesAdmin.py")
ActivitiesConfigService.checkOutConfig("/tmp","cell_name")
- Display current Activities configuration settings :
ActivitiesConfigService.showConfig()
From the returned list, look for the settings that begin with jobs.TrashAutoPurge; these control trash deletion. Determine which property values to change:
- jobs.TrashAutoPurge.daysRetention
- Number of days after which you would like activities and their entries removed from the Trash view. Specify the value in days. Default is 90.
Do not set to 0. When it is set to 0, activities and their entries are not removed from the Trash view.
- jobs.TrashAutoPurge.interval
- Frequency with which the job to check for expired content runs. See Scheduling tasks for information about the format to use to specify the interval. Default is 0 0 2 ? * SUN, which specifies the job should run weekly at 2 AM on Sunday.
- To change the property values:
ActivitiesConfigService.updateConfig(property, value)
For example:
ActivitiesConfigService.updateConfig("jobs.TrashAutoPurge.daysRetention", "100") ActivitiesConfigService.updateConfig("jobs.TrashAutoPurge.interval", "0 15 10 L * ?")The 0 15 10 L * ? value schedules the job to run at 10:15 AM on the last day of every month.
- To prevent the trash purge job from running altogether, we can use the following commands to disable the jobs:
ActivitiesConfigService.updateConfig("jobs.TrashAutoPurge.enabled", "false")
- After making changes, check configuration file back in during the same wsadmin session in which they were checked out.
Example
When making configuration changes to the TrashAutoPurge scheduled job we are modifying settings in oa-config.xml. The following sample oa-config.xml file segment removes content from the Trash view after 100 days and runs the job to check for expired content at 10:15 AM on the last day of every month.<scheduledTasks> <!-- cluster scoped jobs --> <task name="TrashAutoPurgeJob" description="Permanently removes Activities Trash" interval="0 15 10 L * ?" startby="" enabled="true" scope="cluster" type="class" targetName="com.ibm.openactivities.jobs.TrashAutoPurgeJobWS" mbeanMethodName="" serverName="unsupported" > <args> <property name="trashRetentionInDays">100</property> </args> </task> ... <scheduledTasks>
Parent topic:
Manage trash
Related:
Related:
Check out the Activities configuration files