Table of Contents

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:

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: