To ensure that the Alfresco server works smoothly, you must perform regular server maintenance (server clean up). Maintenance frequency depends on how often documents are updated and how many documents are published to the server. If your server stores a large amount of documents, the best practice is to conduct an automated server clean-up. It can also be scheduled as a background task.


To clean up the Alfresco server automatically


  1. Click one of the following links to download and extract the required set of script files specific to your operating system:
  2. Using a text editor, open the cc_installmaint.bat (cc_installmaint.sh for Linux) file.
  3. Specify the values of the following properties:
    • ALFRESCO_ROOT - the full path to the Alfresco Community installation directory.
    • PGUSER - the PostgreSQL user name. The value should be the same as the db.username property value in the<Alfresco Community installation directory>/tomcat/shared/classes/alfresco-global.prop file.
    • PG_PASSWORD - the password used for PostgreSQL user. The value should be the same as the db.password property value in the <Alfresco Community installation directory>/tomcat/shared/classes/alfresco-global.prop file.
  4. Save and close the file.
  5. Run the cc_installmaint.bat/.sh file as administrator (as root for Linux) to execute the script that installs the procedure stored in the collaboratormaint.sql file.

    Important

    • The collaboratormaint.sql file must be in the same location as the cc_installmaint.bat/.sh file.
    • You only need to execute this script once. Running the cc_installmaint.bat/.sh file during subsequent maintenance events merely removes and reinstalls the stored procedure.
    • It is normal to get a warning message when you execute the script for the first time. The warning appears because the DROP FUNCTION command in the collaboratormaint.sql file tries to remove a procedure that does not yet exist. To avoid the error message, open the collaboratormaint.sql file and add a comment sign (--) at the beginning of the line with the DROP FUNCTION command.
  6. Using a text editor, open the cc_maint.bat/.sh file.
  7. Specify the values of the properties listed in step 3.
  8. Save and close the file.
  9. Run the cc_maint.bat/.sh file as administrator (as root for Linux) to execute the scrip that cleans up the Alfresco server by removing deleted documents and Solr4 data.


Recommendation

If you need to perform Alfresco server maintenance frequently (e.g., once a day), run the cc_maint.bat/.sh file as a scheduled task on Windows or as a cron job on Linux.