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/Bundler/sgenshi-dirvish.genshi | 23 +++++++++++ examples/Cfg/etc/cron.d/dirvish/dirvish | 8 ++++ .../etc/dirvish/dirvish-cronjob/dirvish-cronjob | 44 ++++++++++++++++++++++ examples/Properties/dirvish.xml | 9 +++++ .../etc/dirvish/master.conf/template.newtxt | 25 ++++++++++++ 5 files changed, 109 insertions(+) create mode 100644 examples/Bundler/sgenshi-dirvish.genshi create mode 100644 examples/Cfg/etc/cron.d/dirvish/dirvish create mode 100644 examples/Cfg/etc/dirvish/dirvish-cronjob/dirvish-cronjob create mode 100644 examples/Properties/dirvish.xml create mode 100644 examples/TGenshi/etc/dirvish/master.conf/template.newtxt (limited to 'examples') diff --git a/examples/Bundler/sgenshi-dirvish.genshi b/examples/Bundler/sgenshi-dirvish.genshi new file mode 100644 index 000000000..2eb8acd75 --- /dev/null +++ b/examples/Bundler/sgenshi-dirvish.genshi @@ -0,0 +1,23 @@ + + + + +client: nfs-host +tree: /export/homes/${user.text} +exclude: + *~ + .nfs* + + + + + + + + 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 diff --git a/examples/Properties/dirvish.xml b/examples/Properties/dirvish.xml new file mode 100644 index 000000000..a79733f77 --- /dev/null +++ b/examples/Properties/dirvish.xml @@ -0,0 +1,9 @@ + + + + + user1homedir + user2homedir + user3homedir + + diff --git a/examples/TGenshi/etc/dirvish/master.conf/template.newtxt b/examples/TGenshi/etc/dirvish/master.conf/template.newtxt new file mode 100644 index 000000000..6c9750f9d --- /dev/null +++ b/examples/TGenshi/etc/dirvish/master.conf/template.newtxt @@ -0,0 +1,25 @@ +bank: + /backup + +image-default: %Y-%m-%d +log: bzip2 +index: bzip2 +xdev: 1 + +exclude: + lost+found/ + *~ + .nfs* + +Runall: +{% for user in metadata.Properties['dirvish.xml'].data.find('users') %}\ + homes/${user.tag} +{% end %}\ + +expire-default: +2 weeks + +expire-rule: +# MIN HR DOM MON DOW STRFTIME_FMT + * * * * 1 +6 weeks + * * 1-7 * 1 +6 months + * * 1-7 1,4,7,10 1 never -- cgit v1.2.3-1-g7c22