From 770daad7cc4db1a2be8de655bd2e4930dbee236d Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Fri, 31 Jul 2009 00:58:06 +0000 Subject: example repository: Add Dirvish configuration example Signed-off-by: Sol Jerome git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5396 ce84e21b-d406-0410-9b95-82705330c041 --- examples/Cfg/etc/cron.d/dirvish/dirvish | 8 ++++ .../etc/dirvish/dirvish-cronjob/dirvish-cronjob | 44 ++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 examples/Cfg/etc/cron.d/dirvish/dirvish create mode 100644 examples/Cfg/etc/dirvish/dirvish-cronjob/dirvish-cronjob (limited to 'examples/Cfg') diff --git a/examples/Cfg/etc/cron.d/dirvish/dirvish b/examples/Cfg/etc/cron.d/dirvish/dirvish new file mode 100644 index 000000000..7f7d09117 --- /dev/null +++ b/examples/Cfg/etc/cron.d/dirvish/dirvish @@ -0,0 +1,8 @@ +# /etc/cron.d/dirvish: crontab fragment for dirvish + +SHELL=/bin/sh +PATH=/sbin:/bin:/usr/sbin:/usr/bin +MAILTO=root + +# run every night +4 22 * * * root /etc/dirvish/dirvish-cronjob diff --git a/examples/Cfg/etc/dirvish/dirvish-cronjob/dirvish-cronjob b/examples/Cfg/etc/dirvish/dirvish-cronjob/dirvish-cronjob new file mode 100644 index 000000000..1dfb1e374 --- /dev/null +++ b/examples/Cfg/etc/dirvish/dirvish-cronjob/dirvish-cronjob @@ -0,0 +1,44 @@ +#! /bin/sh +# +# daily cron job for the dirvish package +# +# NOTE: This is the sample cron job included in Debian. You may need to +# change the executable paths if running on a different OS. +if [ ! -x /usr/sbin/dirvish-expire ]; then exit 0; fi +if [ ! -s /etc/dirvish/master.conf ]; then exit 0; fi + +mount_check() { + mntout=`tempfile -p mount` + mount $1 >$mntout 2>&1 + if [ ! -d $1/lost+found ]; then # only works for "real" filesystems :-) + # (Yes, I know about reiserfs.) + echo "'mount $1' failed?! Stopping." + echo "mount output:" + cat $mntout + rm -f $mntout + exit 2 + fi + + if stat $1 | grep 'Inode: 2[^0-9]' >/dev/null; then # ditto + rm -f $mntout + return 0 # ok + fi + echo "$1 isn't inode 2 ?! Mount must have failed; stopping." + echo '' + stat $1 + echo "mount output:" + cat $mntout + rm -f $mntout + umount $1 + exit 2 +} + +## Example of how to mount and umount a backup partition... +# mount_check /backup + +/usr/sbin/dirvish-expire --quiet && /usr/sbin/dirvish-runall --quiet +rc=$? + +# umount /backup || rc=$? + +exit $rc -- cgit v1.2.3-1-g7c22