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

_sax
Champ in-the-making
Champ in-the-making
Hi jlabuelo,

I have to admit, that I never set up such a scheduled action. But what you built seems very reasonable. The archive:// context is supposed to look only through deleted items.
Maybe here http://forums.alfresco.com/en/viewtopic.php?f=7&t=15765 is an approach that brings you to the point even more easily.
There is an extension, that cleans deleted items that were "archived" for x days. But I did not test it and it was made for 2.x, so compatibility with 3.x is not ensured.

Just one note: In the line above the lucene syntax in your action it says <!– Find all nodes that do not have the aspect –> while the search phrase seems to do the opposite: find all nodes with that aspect.

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

Yes have checked the tool you point me to, however seems that you have to still run it manually. Our aim was to set up something to run every 7 days and remove the deleted items automatically. We have tried it in a test machine with a back up copy of our production system and seems that works fine ( and pretty fast I must say, much faster than using the UI) just wanted to make sure that we are not deleted anything else 😄 (that would be horrible, we would get complains from business all the time!!!).

About the comment… yeah Smiley Happy  it is because it was a copy/paste from a post we found in the wiki forum… we will modify it right the way!!

Thanks again!

_sax
Champ in-the-making
Champ in-the-making
Glad, you succeeded in it  Smiley Very Happy . As being also interested in this topic, I'm happy to find such a practical and working example. Thank you!

mrey
Champ in-the-making
Champ in-the-making
Good morning all.

Using the scheduled action above,it executes for files with aspect "archived", but the problem is that only deletes 180 files, and there are over 800 which are not deleted. All the files have the aspect "archived" and it executes every saturday at 15:00, and it works for 1 minute.


Somebody can help about this problem?.. maybe you Sax?

Thank you all.

_sax
Champ in-the-making
Champ in-the-making
I'm stuck even before. When I integrate the code above in scheduled-action-services-context.xml I get

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'deleteTrashActionScheduled' is defined

referrring to

        <property name="templateActionDefinition">
            <ref bean="deleteTrashActionScheduled"/>
        </property>

But where could this bean be defined? I suppose it is a custom added one.

mrey
Champ in-the-making
Champ in-the-making
Hello

Sorry, the bean was created by us.

This is the code

The code of scheduled-action-services-context.xml
 <bean id="deleteTrash" class="org.incis.model.actions.DeleteTrashActionExecuter" parent="action-executer">
        <property name="nodeService">
            <ref bean="NodeService" />
        </property>
        <property name="nodeArchiveService">
            <ref bean="NodeArchiveService" />
        </property>
    </bean>


 <bean id="deleteTrashActionScheduled" class="org.alfresco.repo.action.scheduled.SimpleTemplateActionDefinition">
        <property name="actionName">
            <value>deleteTrash</value>
        </property>
        <property name="parameterTemplates">
            <map>
                <entry>
                    <key>
                        <value></value>
                    </key>
                    <value></value>
                </entry>
               
            </map>
        </property>
       
        <property name="templateActionModelFactory">
            <ref bean="templateActionModelFactory"/>
        </property>
        <property name="dictionaryService">
            <ref bean="DictionaryService"/>
        </property>
        <property name="actionService">
            <ref bean="ActionService"/>
        </property>
        <property name="templateService">
            <ref bean="TemplateService"/>
        </property>
    </bean>


The code of DeleteTrashActionExecuter.java

public class DeleteTrashActionExecuter extends ActionExecuterAbstractBase 
{   
   private static Log logger = LogFactory.getLog(DeleteTrashActionExecuter.class);
   
       public static final String NAME = "Delete_Trash";
   
       private NodeService nodeService;
    private NodeArchiveService nodeArchiveService;
   
   
   
    public void setNodeArchiveService(NodeArchiveService nodeArchiveService)
    {
       this.nodeArchiveService = nodeArchiveService;
    }
   
    public NodeArchiveService getNodeArchiveService()
    {
       return nodeArchiveService;
    }
   
    public void setNodeService(NodeService nodeService)
    {
       this.nodeService = nodeService;
    }
   
    public NodeService getNodeService()
    {
       return nodeService;
    }


   protected void addParameterDefinitions(List<ParameterDefinition> paramList)
   {
      paramList.add(new ParameterDefinitionImpl("parametro", DataTypeDefinition.TEXT, true, getParamDisplayLabel("parametro")));
   }



   protected void executeImpl(
         Action ruleAction,
         NodeRef actionedUponNodeRef)
   {
      logger.info("Ejecutandose action automaticamente");
      logger.info("actionedUponNodeRef " + actionedUponNodeRef);
      
      if (this.nodeService.exists(actionedUponNodeRef) == false)
      {
      
return;
        }
      
      getNodeArchiveService().purgeArchivedNode(actionedUponNodeRef);
   }   
   
}

Could you help us? Thanks you in advance

_sax
Champ in-the-making
Champ in-the-making
Thank you. I actually never imported own java classes. I presume, I need Eclipse and produce a .jar file with it?
That said, your problem actually seems to stem more from an issue wih your installation than your code.
I'll try to reproduce it, though if you can point me to the steps required for using a java class.
If you have a testing system with a duplicate of your installation, is it possible to delete everything manually as admin from the recycle bin?
If not, it shows that there is an installation issue, if it is possible your code comes into focus.