Add missing file.

This commit is contained in:
Gunnar Beutner 2013-09-27 10:47:46 +02:00
parent 74708766d1
commit 6970c28292
1 changed files with 67 additions and 0 deletions

67
tools/i2modconf.in Normal file
View File

@ -0,0 +1,67 @@
#!/bin/sh
prefix=@prefix@
exec_prefix=@exec_prefix@
sbindir=@sbindir@
bindir=@bindir@
sysconfdir=@sysconfdir@
localstatedir=@localstatedir@
ICINGA2CONFDIR=@sysconfdir@/icinga2
TOOL=$(basename -- $0)
if [ "$TOOL" != "i2enmod" -a "$TOOL" != "i2dismod" ]; then
echo "Invalid tool name ($TOOL). Should be 'i2enmod' or 'i2dismod'."
exit 1
fi
if [ -z "$1" ]; then
echo "Syntax: $0 <module>"
if [ "$TOOL" = "i2enmod" ]; then
echo "Enables the specified module."
else
echo "Disables the specified module."
fi
echo
echo -n "Available modules: "
for file in $ICINGA2CONFDIR/mods-available/*.conf; do
echo -n $(basename -- $file .conf)
done
echo
exit 1
fi
MOD=$1
if [ ! -e $ICINGA2CONFDIR/mods-available/$MOD.conf ]; then
echo "The module '$MOD' does not exist."
exit 1
fi
if [ "$TOOL" = "i2enmod" ]; then
if [ -e $ICINGA2CONFDIR/mods-enabled/$MOD.conf ]; then
echo "The module '$MOD' is already enabled."
exit 0
fi
ln -s ../mods-available/$MOD.conf $ICINGA2CONFDIR/mods-enabled/
echo "Module '$MOD' was enabled."
elif [ "$TOOL" = "i2dismod" ]; then
if [ ! -e $ICINGA2CONFDIR/mods-enabled/$MOD.conf ]; then
echo "The module '$MOD' is already disabled."
exit 0
fi
rm -f $ICINGA2CONFDIR/mods-enabled/$MOD.conf
echo "Module '$MOD' was disabled."
fi
echo "Make sure to restart Icinga 2 for these changes to take effect."
exit 0