userspace: add example cronjob

This commit is contained in:
Thomas Schoebel-Theuer 2016-04-14 08:14:01 +02:00
parent 2659864765
commit f048aec390
1 changed files with 19 additions and 0 deletions

19
userspace/cron.d/mars Normal file
View File

@ -0,0 +1,19 @@
# Regular cron jobs for MARS
#
PATH=/usr/local/bin:/usr/lib/mars:/sbin:/bin:/usr/sbin:/usr/bin
# MARS transaction logfile rotation + deletion every x minutes
*/10 * * * * root if [ -L /mars/uuid ] ; then marsadm log-delete-all all; sleep 3 ; marsadm log-rotate all ; fi > /dev/null 2>&1
# When a different mars kernel module is installed than actually loaded
# into the kernel, _try_ to reload it.
# This will silently fail when at least one resource is in primary mode.
# However, this will be automatically retried until it succeeds some day.
# This leads to a very short interruption of the replication, similar
# to a small network outage. It does not change any state: it relies on
# the fundamental property of MARS to restore _any_ previous operation mode
# after a crash, just by a simple modprobe.
@hourly root if [ -L /mars/uuid -a -e /sys/module/mars/version ] && [ "$(modinfo mars | grep "^version:" | sed 's/^version:\s*//')" != "$(cat /sys/module/mars/version)" ]; then rmmod mars && modprobe mars ; fi > /dev/null 2>&1