blob: 9a93c2e44db794cc6af060e05e852b5b420ba018 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#!/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
# This script will respect additional variables:
# BCFG_OPTIONS_DAILY and BCFG_OPTIONS_HOURLY are added to BCFG2_OPTIONS
# This allows you to run different types of passes with cron
BCFG2_OPTIONS="-q"
# bcfg2 file locations
BCFG2_BIN=/usr/sbin/bcfg2
BCFG2_CFG=/etc/bcfg2.conf
# Read the configuration from /etc/default/bcfg2
[ -e /etc/default/bcfg2 ] && . /etc/default/bcfg2
# Check that configuration and executable exists
[ -x ${BCFG2_BIN} -a -e ${BCFG2_CFG} ] || exit 1
invoke_bcfg2 () {
# Invoke bcfg2 if enabled
if [ ${BCFG2_ENABLED} -eq 1 ]; then
eval BCFG2_EXTRA_OPTIONS=\${BCFG2_OPTIONS_${RUNTYPE}}
${BCFG2_BIN} ${BCFG2_OPTIONS} ${BCFG2_EXTRA_OPTIONS}
fi
}
case $1 in
"--daily")
[ "x${BCFG2_CRON}" = "xdaily" -o "x${BCFG2_CRON}" = "xboth" ] && \
RUNTYPE=DAILY invoke_bcfg2
;;
"--hourly")
[ "x${BCFG2_CRON}" = "xhourly" -o "x${BCFG2_CRON}" = "xboth" ] && \
RUNTYPE=HOURLY invoke_bcfg2
;;
*)
echo "Usage: $0 [--daily|--hourly]"
exit 1
;;
esac
|