diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2006-07-24 19:18:17 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2006-07-24 19:18:17 +0000 |
commit | d99a102b867a40a8da7869ca07490ece3cbf3316 (patch) | |
tree | 3119769b407327b6287c178e6d59f88687d79ab8 /tools/bcfg2-cron | |
parent | 44e01b4d8b8ae6f68314c229e05f0c690ffeddaa (diff) | |
download | bcfg2-d99a102b867a40a8da7869ca07490ece3cbf3316.tar.gz bcfg2-d99a102b867a40a8da7869ca07490ece3cbf3316.tar.bz2 bcfg2-d99a102b867a40a8da7869ca07490ece3cbf3316.zip |
Add the cron stuff to the repo
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2000 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'tools/bcfg2-cron')
-rw-r--r-- | tools/bcfg2-cron | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tools/bcfg2-cron b/tools/bcfg2-cron new file mode 100644 index 000000000..6dfa5db66 --- /dev/null +++ b/tools/bcfg2-cron @@ -0,0 +1,45 @@ +#!/bin/sh +# +# Script to run bcfg2 with cron. +# +# This script is designed so that bcfg2-cron can be invoked from both +# /etc/cron.daily and /etc/cron.hourly. This allows the administrators to +# modify /etc/default/bcfg2 and define the wanted frequency of cron runs. +# + +# Default is not to run at all from cron +BCFG2_CRON=off +BCFG2_ENABLED=0 + +# Set default options +BCFG2_OPTIONS="-q" + +# bcfg2 file locations +BCFG2_BIN=/usr/sbin/bcfg2 +BCFG2_CFG=/etc/bcfg2.conf + +# Check that configuration and executable exists +[ -x ${BCFG2_BIN} -a -e ${BCFG2_CFG} ] || exit 1 + +# Read the configuration from /etc/default/bcfg2 +[ -e /etc/default/bcfg2 ] && . /etc/default/bcfg2 + +invoke_bcfg2 () { + # Invoke bcfg2 if enabled + if [ ${BCFG2_ENABLED} -eq 1 ]; then + ${BCFG2_BIN} ${BCFG2_OPTIONS} + fi +} + +case $1 in + "--daily") + [ "x${BCFG2_CRON}" = "xdaily" ] && invoke_bcfg2 + ;; + "--hourly") + [ "x${BCFG2_CRON}" = "xhourly" ] && invoke_bcfg2 + ;; + *) + echo "Usage: $0 [--daily|--hourly]" + exit 1 + ;; +esac |