Difference between revisions of "SUNScholar/Optimisations/Error Logs"
Jump to navigation
Jump to search
| (2 intermediate revisions by the same user not shown) | |||
| Line 11: | Line 11: | ||
==Step 2. Create script, by typing the following:== | ==Step 2. Create script, by typing the following:== | ||
| − | nano | + | nano $HOME/scripts/error-logs |
Copy and paste the following: | Copy and paste the following: | ||
<pre> | <pre> | ||
| Line 19: | Line 19: | ||
LIST="root,ismith@sun.ac.za,plt@sun.ac.za" | LIST="root,ismith@sun.ac.za,plt@sun.ac.za" | ||
| − | cd | + | cd $HOME/log |
cat dspace.log.$TODAY | grep -v INFO > /tmp/dspace-error.log | cat dspace.log.$TODAY | grep -v INFO > /tmp/dspace-error.log | ||
cat cocoon.log.$TODAY | grep -v INFO > /tmp/cocoon-error.log | cat cocoon.log.$TODAY | grep -v INFO > /tmp/cocoon-error.log | ||
| Line 32: | Line 32: | ||
==Step 3. Add the script to the daily "dspace user" crontab.== | ==Step 3. Add the script to the daily "dspace user" crontab.== | ||
See: http://wiki.lib.sun.ac.za/index.php/SUNScholar/Daily_Admin | See: http://wiki.lib.sun.ac.za/index.php/SUNScholar/Daily_Admin | ||
| + | [[Category:System Administration]] | ||
Latest revision as of 11:48, 28 May 2016
Back to Optimisations
To inform ourselves of errors on a daily basis, a script was written and is run daily to email us the error output of the logs.
Follow the procedure below to perform the same.
Step 1. Login as the dspace user.
Click on the heading above.
Step 2. Create script, by typing the following:
nano $HOME/scripts/error-logs
Copy and paste the following:
#!/bin/bash TODAY=`date +%F` LIST="root,ismith@sun.ac.za,plt@sun.ac.za" cd $HOME/log cat dspace.log.$TODAY | grep -v INFO > /tmp/dspace-error.log cat cocoon.log.$TODAY | grep -v INFO > /tmp/cocoon-error.log cat /tmp/dspace-error.log | mail -s "Error log for SUNScholar" $LIST cat /tmp/cocoon-error.log | mail -s "Error log for SUNScholar XMLUI" $LIST rm -f /tmp/dspace-error.log rm -f /tmp/cocoon-error.log
Change LIST to a comma separated list of emails of persons who to want to receive the error reports.
- 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)
Step 3. Add the script to the daily "dspace user" crontab.
See: http://wiki.lib.sun.ac.za/index.php/SUNScholar/Daily_Admin