About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


Warning: This page has not been updated in over over a year and may be outdated or deprecated.
administration:automation

Automation

properties
Page Ownerdemiankatz

Once VuFind® is running, you still need to do some work to keep it up to date and stable. The exact details of VuFind® automation will vary significantly based on your ILS and operating system. However, these are the general common goals:

  • Update VuFind®'s index with the latest changed and added records from your ILS. See the MARC Export Notes for help with this.
  • Remove deleted and suppressed records from VuFind®'s index. VuFind® is packaged with tools in the util directory that can help with this, but functionality may be limited depending on the capabilities of your ILS.
  • Remove expired data from VuFind®'s database (see documentation for the various “expire”-related Command Line Utilities for more details).
  • You may wish to make sure the Solr index is regularly optimized for minimal space usage and improved performance, though this is not as important for newer versions of Solr as it used to be. However, optimization can be a good way to ensure that all uncommitted changes become visible. There is a stand-alone optimize tool in the util directory.
  • Dump the MySQL database for backup purposes.
  • Periodically restart Solr – if it runs for extremely long periods of time, like any complex piece of software, it may become unstable.

The remainder of this page shows specific solutions to these goals. Feel free to add your own ideas to this page if you wish. You may not be able to use these solutions exactly as-is, but hopefully the ideas included will help you get things running the way you want.

General Advice

Using cron

If you need to automate tasks under Linux, you will want to become familiar with the cron process. This allows you to schedule programs to run at specific intervals, either as root or as a particular user. The details of using cron are beyond the scope of this document, but there are many helpful resources available elsewhere. The Wikipedia page on the subject is probably a good starting point.

cron-friendly Solr script

If you want to restart VuFind®'s Solr instance via cron, the best thing is to set it up as a system service that can be restarted with systemctl or an equivalent command. See Running Solr Automatically for details on how to set up Solr as a service.

Why restart Solr?

The main reason to regularly restart the VuFind® Solr instance is to ensure system stability. Due to the way Java garbage collection works, Solr can eventually run out of memory and stop responding; periodic restarts are an easy way to avoid this problem. It is also a good idea to investigate Java tuning to address the root cause – but even with a well-tuned system, occasional restarts (such as, on a weekly basis) can help ensure long-term stability.

Using mysqldump

If you want to back up VuFind®'s MySQL database, the mysqldump tool that comes with MySQL itself makes this pretty simple. You can see the tool's man page for all the details. Here is a sample script for nightly backups via cron:

#!/bin/sh
WORKDIR=/usr/local/vufind/mysqldump
DATE=`date '+%y%m%d'`
MYSQLUSER=root
MYSQLPASS=password
VUFIND_DB=vufind
 
# Dump MySQL database to disk
/usr/bin/mysqldump -l --default-character-set=utf8 --password=$MYSQLPASS -u$MYSQLUSER $VUFIND_DB >$WORKDIR/vufind_mysql_dump.$DATE
 
# Compress the dump to save space
gzip -f $WORKDIR/vufind_mysql_dump.$DATE
exit

Important: The backup will cause your database to lock while it is running, so you should schedule it for a time of low activity.

Automation Examples

This section provides examples of automating interactions between VuFind® and other systems:

administration/automation.txt · Last modified: 2023/03/06 20:48 by demiankatz