cancel
Showing results for 
Search instead for 
Did you mean: 

Running Tasks Automatically and periodically

jlabuelo
Champ on-the-rise
Champ on-the-rise
Good Morning all

I have a question and hope that someone can help us here. We know that when a node is deleted in Alfresco, it remains in a temporary "space" so it can be recovered if needed, or another cause could be if it has been deleted by mistake.

After 3 months using Alfresco we have now 4 GB in that temporary space. Is there any way to configure Alfresco so this space is cleaned out once a week, so it does not affect  the Backup processes. I mean we assume that when we run a backup, these space is also backed up, which is consuming disk space that we need.

Any ideas of how we can configure this to delete this "removed" nodes once a week at a specific time, or the only way is manually?

Thanks a lot in advane
16 REPLIES 16

jlabuelo
Champ on-the-rise
Champ on-the-rise
Hi there

So… non has thought about this situation before? did anybody got this solved with any "periodic" rule or something?… Any ideas will be very welcome!!

Cheers  Smiley Happy

mabayona
Champ on-the-rise
Champ on-the-rise
To delete files from a specific folder in the File System you can use the good & old cron.

If you want to do it from inside Alfresco, I can think of two ways of doing it:

1) Web Scripts that can be run using your favorite scheduler (e.g. cron) via a REST interface.
2) Using a jBPM timer + custom advanced workflow to run a javascript task/action that does what you want.

It is simpler to use web scripts although using a jBPM timer is safer and not that difficult to do.

Regards.

jlabuelo
Champ on-the-rise
Champ on-the-rise
Hey

Thanks for the help… gonna check how this can be implemented and try it

Cheers

mrogers
Star Contributor
Star Contributor
Or you can use the job scheduler which is how the purge job (which is the thing placing the files out of the way) runs.

http://wiki.alfresco.com/wiki/Content_Store_Configuration

jlabuelo
Champ on-the-rise
Champ on-the-rise
Thanks a lot for the help mrogers. So Basically from my understanding, if I configure the "contentStoreCleaner" as it is explained in the document you sent us, files after "protectDays" will be moved to the "deletedContentStore" of the application, which normally is the physical file in the OS
contentstore.deleted (C:\Alfresco\alf_data\contentstore.deleted)
so what I must do is configuring the OS to delete the files withing the folder
contentstore.deleted

Basically the timings could be

a) Configure the "contentStoreCleaner" so all files deleted and older than 7 days get deleted and moved the  "deletedContentStore"

b) Run the backup of the application

c) set up the OS to run a script to delete the files within C:\Alfresco\alf_data\contentstore.deleted

And after that if I log in the application and go to the "Manage Deleted Content" screen I should only see items deleted in the last 7 days

is it correct the way I am understanding it?…. anything missing from my side?

Thanks once more Smiley Happy

jlabuelo
Champ on-the-rise
Champ on-the-rise
Hi there

Anyone can confirm that my understanding is the right one? Dont wanna start deleting folders in Alfresco and lose everything 🙂

Cheers

_sax
Champ in-the-making
Champ in-the-making
If you just delete files from the filesystem, the corresponding entries in your database are going to get orphaned. That is probably corrupting your installation.
I would opt for a workflow timer, so starting a workflow that is going to run permanently, including a timer task that does find all files older than 7 days via Lucene.
If you alter your workflow you can just stop it from the workflow console or via the tasks done dashlet in My Alfresco and redeploy your new workflow definition.

jlabuelo
Champ on-the-rise
Champ on-the-rise
Hi Sax

Thanks a lot, that sounds reasonable

Cheers and thanks

jlabuelo
Champ on-the-rise
Champ on-the-rise
Hi Sax, have a question for you in order to make sure I dont screw everything up 🙂

We are trying to set up a Scheduler Task to remove from the system all the  "deleted items" that are still kept in Alfresco after you delete them from their spaces. So we are trying to set it up to access the space where these items are stored and remove them forever. We would like to set it up to be run automatically once a week. The way we did it seems it works, looks for the items with aspect "Archived" and removes them.

Our question is ¿Are we sure these "Archived" aspect is the one that points "ONLY" to the deleted items? ¿Do you know if just searching by this aspect I would get any other item I do not want to delete? ¿Any other alternative to make this task automatic?

Here is the action scheduler we have created
<bean id="programDeleteTrash" class="org.alfresco.repo.action.scheduled.CronScheduledQueryBasedTemplateActionDefinition">
        <property name="transactionMode">
            <value>UNTIL_FIRST_FAILURE</value>
        </property>
        <property name="compensatingActionMode">
            <value>IGNORE</value>
        </property>
        <property name="searchService">
            <ref bean="SearchService"/>
        </property>
        <property name="templateService">
            <ref bean="TemplateService"/>
        </property>
        <property name="queryLanguage">
            <value>lucene</value>
        </property>
        <property name="stores">
            <list>
                <value>archive://SpacesStore</value>
            </list>
        </property>
        <!– Find all nodes that do not have the aspect –>
        <property name="queryTemplate">
           <value>+ASPECT:"{http://www.alfresco.org/model/system/1.0}archived"</value>
        </property>
        <property name="cronExpression">
       <value>0 0 14 ? * SAT</value>
        </property>
        <property name="jobName">
            <value>jobB</value>
        </property>
        <property name="jobGroup">
            <value>jobGroupB</value>
        </property>
        <property name="triggerName">
            <value>triggerB</value>
        </property>
        <property name="triggerGroup">
            <value>triggerGroupB</value>
        </property>
        <!– Inject the scheduler - the trigger will be registered with this scheduler –>
        <property name="scheduler">
            <ref bean="schedulerFactory"/>
        </property>
        <property name="actionService">
            <ref bean="ActionService"/>
        </property>
        <property name="templateActionModelFactory">
            <ref bean="templateActionModelFactory"/>
        </property>
        <property name="templateActionDefinition">
            <ref bean="deleteTrashActionScheduled"/>
        </property>
        <property name="transactionService">
            <ref bean="TransactionService"/>
        </property>
        <property name="runAsUser">
            <value>admin</value>
        </property>
    </bean>