SUNScholar/Daily Admin/3.X

Back to Daily Admin

Step 1. Login
http://wiki.lib.sun.ac.za/index.php/SUNScholar/Prepare_Ubuntu/S01 Click on the link above to find out how to login to the server and then return here.

Step 2. Create "dspace" user crontab
Edit the crontab, by typing the following in a terminal:

su - dspace

crontab -e If asked to select an editor, choose nano

Sample crontab
MAILTO="root"
 * 1) Initialize Environment Variables #
 * 2) Deliver cron email to system administrator
 * 1) Deliver cron email to system administrator
 * 1) Deliver cron email to system administrator

3 0,8,16 * * * $HOME/bin/dspace generate-sitemaps > /dev/null
 * 1) Hourly #
 * 2) Regenerate System Sitemaps every 8 hours
 * 3) at 3 minutes past the hour
 * 1) Regenerate System Sitemaps every 8 hours
 * 2) at 3 minutes past the hour

@hourly	   $HOME/bin/dspace itemcounter > /dev/null
 * 1) Update item counts every hour

30 0 * * * $HOME/bin/dspace stat-general > /dev/null 35 0 * * * $HOME/bin/dspace stat-monthly > /dev/null
 * 1) Nightly #
 * 12:30AM
 * 1) Run DSpace statistical analysis tools (12months takes approx 40secs)
 * 12:30AM
 * 1) Run DSpace statistical analysis tools (12months takes approx 40secs)

00 1 * * * $HOME/bin/dspace stat-report-general > /dev/null 05 1 * * * $HOME/bin/dspace stat-report-monthly > /dev/null
 * 1:00AM
 * 1) Generate DSpace statistical analysis reports

0 2 * * * $HOME/bin/dspace filter-media -n -v > $HOME/log/media-filter.log 2>&1
 * 2:00AM
 * 1) Run the DSpace media filter scripts and save all output to a log file
 * 2) (Creates image thumbnails, indexes full text, and
 * 3) performs any automated format conversions)

0 3 * * * $HOME/bin/dspace index-update > /dev/null
 * 3:00AM
 * 1) Update simple, advanced search and browse indexes

0 5 * * * $HOME/bin/dspace embargo-lifter -v > $HOME/log/embargo-release.log 2>&1
 * 5:00AM
 * 1) Check for items to release from embargo in DSpace.
 * 2) !!!It is good idea to regularly check the file $HOME/log/embargo-release.log for warnings!!!

0 6 * * * $HOME/bin/dspace oai import -o > /dev/null
 * 6:00AM
 * 1) Run XOAI incremental import (and optimization)

30 6 * * * $HOME/bin/dspace stats-util -i > /dev/null
 * 6:30AM
 * 1) Cleanup Web Spiders from DSpace Statistics Solr Index
 * 2) -i deletes all spiders matched by IP address, DNS name or Agent name

0 7 * * * $HOME/bin/dspace update-discovery-index -o > /dev/null
 * 7:00AM
 * 1) Optimize Discovery Solr Index

30 7 * * * $HOME/bin/dspace stats-util -o > /dev/null
 * 7:30AM
 * 1) Optimize DSpace Statistics Solr Index

0 8 * * * $HOME/bin/dspace sub-daily > /dev/null
 * 8:00AM
 * 1) Send out DSpace subscription emails
 * 2) (This alerts users of newly deposited items of interest)


 * 1) Weekly #
 * 1) Weekly #

01 0 1 * * find $HOME/log/*.log.* -mtime +30 -exec rm {} \;
 * 1) Monthly #
 * 12:01AM
 * 1) Remove all DSpace log files which are more than 30 days old
 * 2) on the first of every month
 * 1) Remove all DSpace log files which are more than 30 days old
 * 2) on the first of every month

0 1 1 * * $HOME/bin/dspace cleanup > /dev/null
 * 1:00AM
 * 1) Completely remove any deleted bitstreams in DSpace
 * 2) on the first of every month

0 2 1 * * find $HOME/config -name "*-*-*.old" -mtime +30 -exec rm {} \; 0 2 1 * * find $HOME/*.bak-*-* -maxdepth 0 -type d -mtime +30 -exec rm -rf {} \;
 * 2:00AM
 * 1) Delete any ~/config/*/*.old files more than 30 days old (created by "ant update")
 * 1) Delete any ~/*.bak-*-*/ directories more than 30 days old (created by "ant update")

Save and exit the file.

System Log
To enable logging of cron events, edit the following file: sudo nano /etc/rsyslog.d/50-default.conf Enable the cron log, see example below: auth,authpriv.*                /var/log/auth.log cron.*                         -/var/log/cron.log
 * 1) First some standard log files.  Log by facility.
 * 1) First some standard log files.  Log by facility.
 * .*;auth,authpriv.none         -/var/log/syslog

Now restart the syslog service as follows: sudo service rsyslog restart