Difference between revisions of "SUNScholar/Daily Admin/1.8.X"

From Libopedia
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
Line 8: Line 8:
  
 
==Step 2. Create "dspace" user crontab==
 
==Step 2. Create "dspace" user crontab==
The "dspace" user has to perform tasks automatically at regular intervals, such as sending out subscription emails.
 
 
On a Linux/Unix system this is easy to accomplish using the "cron" functionality.
 
 
 
Edit the crontab, by typing the following in a terminal:
 
Edit the crontab, by typing the following in a terminal:
  
Line 21: Line 17:
 
{{NANO}}
 
{{NANO}}
  
===Sample crontab (superseded by 3.2 daily admin)===
+
==Sample crontab ([[SUNScholar/Daily_Admin/3.X|superseded by 3.2 daily admin]])==
 
<pre>
 
<pre>
 
# m h  dom mon dow  command
 
# m h  dom mon dow  command
Line 31: Line 27:
 
### http://wiki.lib.sun.ac.za/index.php/SUNScholar/Embargo_Systems ###
 
### http://wiki.lib.sun.ac.za/index.php/SUNScholar/Embargo_Systems ###
 
## Check for lifted embargos ##
 
## Check for lifted embargos ##
#05 0 * * *      /home/dspace/bin/dspace embargo-lifter -a -v
+
#05 0 * * *      $HOME/bin/dspace embargo-lifter -a -v
 
##The above option is made available with DSpace 3.2 only
 
##The above option is made available with DSpace 3.2 only
#10 0 * * *      /home/dspace/bin/dspace embargo-lifter -l -v
+
#10 0 * * *      $HOME/bin/dspace embargo-lifter -l -v
#15 0 * * *      /home/dspace/bin/dspace embargo-lifter -c -v
+
#15 0 * * *      $HOME/bin/dspace embargo-lifter -c -v
  
 
### See wiki customisation page for setup details ###
 
### See wiki customisation page for setup details ###
 
### http://wiki.lib.sun.ac.za/index.php/SUNScholar/Browse_Indexes ###
 
### http://wiki.lib.sun.ac.za/index.php/SUNScholar/Browse_Indexes ###
 
## Update item search and browse indexes ##
 
## Update item search and browse indexes ##
0 3 * * *      /home/dspace/bin/dspace index-update
+
0 3 * * *      $HOME/bin/dspace index-update
  
 
### See wiki customisation page for setup details ###
 
### See wiki customisation page for setup details ###
 
### http://wiki.lib.sun.ac.za/index.php/SUNScholar/SOLR_Statistics ##
 
### http://wiki.lib.sun.ac.za/index.php/SUNScholar/SOLR_Statistics ##
 
## SOLR stats update ##
 
## SOLR stats update ##
@daily          /home/dspace/bin/dspace stats-util -b -r   
+
@daily          $HOME/bin/dspace stats-util -b -r   
@weekly        /home/dspace/bin/dspace stats-util -o
+
@weekly        $HOME/bin/dspace stats-util -o
@monthly        /home/dspace/bin/dspace stats-util -u -m -i -f
+
@monthly        $HOME/bin/dspace stats-util -u -m -i -f
  
 
### See wiki customisation page for setup details ###
 
### See wiki customisation page for setup details ###
 
### http://wiki.lib.sun.ac.za/index.php/SUNScholar/SOLR_Discovery ###
 
### http://wiki.lib.sun.ac.za/index.php/SUNScholar/SOLR_Discovery ###
 
## SOLR discovery update ##
 
## SOLR discovery update ##
@daily          /home/dspace/bin/dspace update-discovery-index
+
@daily          $HOME/bin/dspace update-discovery-index
@weekly        /home/dspace/bin/dspace update-discovery-index -o
+
@weekly        $HOME/bin/dspace update-discovery-index -o
@monthly        /home/dspace/bin/dspace update-discovery-index -c
+
@monthly        $HOME/bin/dspace update-discovery-index -c
  
 
## Generate sitemaps for Google indexing ##
 
## Generate sitemaps for Google indexing ##
0 6 * * *      /home/dspace/bin/dspace generate-sitemaps
+
0 6 * * *      $HOME/bin/dspace generate-sitemaps
  
 
## Item counts ##
 
## Item counts ##
@hourly /home/dspace/bin/dspace itemcounter
+
@hourly $HOME/bin/dspace itemcounter
  
 
## Send out subscription e-mails ##
 
## Send out subscription e-mails ##
0 1 * * *      /home/dspace/bin/dspace sub-daily
+
0 1 * * *      $HOME/bin/dspace sub-daily
 
   
 
   
 
## Run the media filter ##
 
## Run the media filter ##
 
## This is setup to run weekly to reduce server load ##
 
## This is setup to run weekly to reduce server load ##
 
## It can be setup to run nightly if you want ##
 
## It can be setup to run nightly if you want ##
@weekly         /home/dspace/bin/dspace filter-media
+
@weekly         $HOME/bin/dspace filter-media -n -v
  
 
## Bitstream checks ##
 
## Bitstream checks ##
@weekly        /home/dspace/bin/dspace checker-emailer -a
+
@weekly        $HOME/bin/dspace checker-emailer -a
@monthly        /home/dspace/bin/dspace checker -p -l
+
@monthly        $HOME/bin/dspace checker -p -l
@monthly  /home/dspace/bin/dspace cleanup -v
+
@monthly  $HOME/bin/dspace cleanup -v
  
 
### The following are not needed if using the new SOLR stats above ###
 
### The following are not needed if using the new SOLR stats above ###
 
## Run stat analyses ##
 
## Run stat analyses ##
#10 1 * * *      /home/dspace/bin/dspace stat-general
+
#10 1 * * *      $HOME/bin/dspace stat-general
#20 1 * * *      /home/dspace/bin/dspace stat-monthly
+
#20 1 * * *      $HOME/bin/dspace stat-monthly
  
 
## Run stat analyses reports ##
 
## Run stat analyses reports ##
#10 2 * * *      /home/dspace/bin/dspace stat-report-general
+
#10 2 * * *      $HOME/bin/dspace stat-report-general
#20 2 * * *      /home/dspace/bin/dspace stat-report-monthly
+
#20 2 * * *      $HOME/bin/dspace stat-report-monthly
 
</pre>
 
</pre>
 +
 +
==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:
 +
<pre>
 +
#
 +
# First some standard log files.  Log by facility.
 +
#
 +
auth,authpriv.*                /var/log/auth.log
 +
*.*;auth,authpriv.none          -/var/log/syslog
 +
cron.*                          -/var/log/cron.log
 +
</pre>
 +
 +
{{NANO}}
 +
 +
Now restart the syslog service as follows:
 +
sudo service rsyslog restart
 +
 +
==References==
 +
*https://wiki.duraspace.org/display/DSDOC18/Installation#Installation-'cron'Jobs
 +
*https://wiki.duraspace.org/display/DSDOC17/Installation#Installation-'cron'Jobs

Latest revision as of 12:29, 13 March 2015

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


NANO Editor Help
CTL+O = Save the file and then press Enter
CTL+X = Exit "nano"
CTL+K = Delete line
CTL+U = Undelete line
CTL+W = Search for %%string%%
CTL+\ = Search for %%string%% and replace with $$string$$
CTL+C = Show line numbers

More info = http://en.wikipedia.org/wiki/Nano_(text_editor)


Sample crontab (superseded by 3.2 daily admin)

# m h  dom mon dow   command
MAILTO="root"

### Setup embargoes before enabling this ###
### After embargoes are setup, remove the hash to enable embargo checking ###
### See wiki customisation page for setup details ###
### http://wiki.lib.sun.ac.za/index.php/SUNScholar/Embargo_Systems ###
## Check for lifted embargos ##
#05 0 * * *      $HOME/bin/dspace embargo-lifter -a -v
##The above option is made available with DSpace 3.2 only
#10 0 * * *      $HOME/bin/dspace embargo-lifter -l -v
#15 0 * * *      $HOME/bin/dspace embargo-lifter -c -v

### See wiki customisation page for setup details ###
### http://wiki.lib.sun.ac.za/index.php/SUNScholar/Browse_Indexes ###
## Update item search and browse indexes ##
0 3 * * *       $HOME/bin/dspace index-update

### See wiki customisation page for setup details ###
### http://wiki.lib.sun.ac.za/index.php/SUNScholar/SOLR_Statistics ##
## SOLR stats update ##
@daily          $HOME/bin/dspace stats-util -b -r   
@weekly         $HOME/bin/dspace stats-util -o
@monthly        $HOME/bin/dspace stats-util -u -m -i -f

### See wiki customisation page for setup details ###
### http://wiki.lib.sun.ac.za/index.php/SUNScholar/SOLR_Discovery ###
## SOLR discovery update ##
@daily          $HOME/bin/dspace update-discovery-index
@weekly         $HOME/bin/dspace update-discovery-index -o
@monthly        $HOME/bin/dspace update-discovery-index -c

## Generate sitemaps for Google indexing ##
0 6 * * *       $HOME/bin/dspace generate-sitemaps

## Item counts ##
@hourly		$HOME/bin/dspace itemcounter

## Send out subscription e-mails ##
0 1 * * *       $HOME/bin/dspace sub-daily
 
## Run the media filter ##
## This is setup to run weekly to reduce server load ##
## It can be setup to run nightly if you want ##
@weekly	        $HOME/bin/dspace filter-media -n -v

## Bitstream checks ##
@weekly         $HOME/bin/dspace checker-emailer -a
@monthly        $HOME/bin/dspace checker -p -l
@monthly  	$HOME/bin/dspace cleanup -v

### The following are not needed if using the new SOLR stats above ###
## Run stat analyses ##
#10 1 * * *      $HOME/bin/dspace stat-general
#20 1 * * *      $HOME/bin/dspace stat-monthly

## Run stat analyses reports ##
#10 2 * * *      $HOME/bin/dspace stat-report-general
#20 2 * * *      $HOME/bin/dspace stat-report-monthly

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:

#
# First some standard log files.  Log by facility.
#
auth,authpriv.*                 /var/log/auth.log
*.*;auth,authpriv.none          -/var/log/syslog
cron.*                          -/var/log/cron.log

NANO Editor Help
CTL+O = Save the file and then press Enter
CTL+X = Exit "nano"
CTL+K = Delete line
CTL+U = Undelete line
CTL+W = Search for %%string%%
CTL+\ = Search for %%string%% and replace with $$string$$
CTL+C = Show line numbers

More info = http://en.wikipedia.org/wiki/Nano_(text_editor)


Now restart the syslog service as follows:

sudo service rsyslog restart

References