For more than a year I have been running my own virtual host (thanks to Tom for helping with the setup of the mail system). Before I had almost no skills regarding Linux administration. Meanwhile I’m kindof able to maintain it and add this and that. For a while a few tasks have been pending
- Frequent logging file reports
- Monthly backup
- Moving backup files to some external storage service
Due to my pretty constrained time budget only now I was able to spend some hours on getting some task done.
For Frequent logging file reports I added logwatch to my system, customized it in /etc/logwatch/conf/logwatch.conf.
# Default person to mail reports to. Can be a local account or a # complete email address. MailTo = recipient@domain # Default person to mail reports from. Can be a local account or a # complete email address. MailFrom = Logwatch # If set to 'Yes', the report will be sent to stdout instead of being # mailed to above person. Print = No
I added logwatch to my daily cron jobs in /etc/cron.daily/logwatch
test -x /usr/share/logwatch/scripts/logwatch.pl || exit 0 /usr/share/logwatch/scripts/logwatch.pl
I added a /etc/cron.monthly/backup script for performing monthly backups of important system files
outputFolder=/var/tmp/backup now=`date +%Y%m%d%H%M` hostname=`hostname` outputFolder=$outputFolder/$hostname/$now if [ -d $outputFolder ] then echo "Backup has alread run on '$hostname' for '$now'" exit 1 else mkdir --parents --verbose $outputFolder fi echo backup... options=-cvvz tar $options --file=$outputFolder/backup.tar.gz --exclude=/var/cache/* --exclude=/var/spool/* --exclude=/var/lock/* --exclude=/var/run/* --exclude=/var/tmp/* --exclude=/var/log/* /var /etc /home 1>$outputFolder/backup.log echo "Backup for $hostname ready at $outputFolder/backup.tar.gz" | mail -s "Backup completed for $hostname `date`" recipient@domain
Sun mostly sticks with java.util.logging (jul) in their products. jul is fairly unflexible but we need to live with it. However I usually would use log4j with slf4j as logging facade. In order to get more control over jul logging output you can use the slf4j to java.util.logging bridge. Here I show how to set it up with Spring and Maven
org.slf4j jul-to-slf4j 1.5.4 org.slf4j slf4j-log4j12 1.5.4 log4j log4j 1.2.15 com.sun.jmx jmxri com.sun.jdmk jmxtools