2 ICINGA2CONFDIR=@CMAKE_INSTALL_FULL_SYSCONFDIR@/icinga2
6 if [ "$TOOL" != "icinga2-enable-feature" -a "$TOOL" != "icinga2-disable-feature" ]; then
7 echo "Invalid tool name ($TOOL). Should be 'icinga2-enable-feature' or 'icinga2-disable-feature'."
12 echo "Syntax: $TOOL <features separated with whitespaces>"
13 echo " Example: $TOOL checker notification mainlog"
15 if [ "$TOOL" = "icinga2-enable-feature" ]; then
16 echo "Enables the specified feature(s)."
18 echo "Disables the specified feature(s)."
22 echo -n "Available features: "
24 for file in $ICINGA2CONFDIR/features-available/*.conf; do
25 echo -n "$(basename -- $file .conf) "
29 echo -n "Enabled features: "
31 for file in $ICINGA2CONFDIR/features-enabled/*.conf; do
32 echo -n "$(basename -- $file .conf) "
46 # Based http://blog.isonoe.net/post/2010/09/24/Pseudo-arrays-for-POSIX-shell
47 eval "set -- $FEATURES"
51 if [ ! -e $ICINGA2CONFDIR/features-available/$FEATURE.conf ]; then
52 echo "Feature '$FEATURE' does not exist."
56 if [ "$TOOL" = "icinga2-enable-feature" ]; then
57 if [ -e $ICINGA2CONFDIR/features-enabled/$FEATURE.conf ]; then
58 echo "The feature '$FEATURE' is already enabled."
61 if [ "$SKIP" != "OK" ]; then
62 if ! ln -s ../features-available/$FEATURE.conf $ICINGA2CONFDIR/features-enabled/; then
63 echo "Enabling '$FEATURE' failed. Check permissions for $ICINGA2CONFDIR/features-enabled/"
66 echo "Module '$FEATURE' was enabled."
70 elif [ "$TOOL" = "icinga2-disable-feature" ]; then
71 if [ ! -e $ICINGA2CONFDIR/features-enabled/$FEATURE.conf ]; then
72 echo "The feature '$FEATURE' is already disabled."
76 if [ "$SKIP" != "OK" ]; then
77 if ! rm -f $ICINGA2CONFDIR/features-enabled/$FEATURE.conf; then
78 echo "Disabling '$FEATURE' failed. Check permissions for $ICINGA2CONFDIR/features-enabled/$FEATURE.conf"
81 echo "Feature '$FEATURE' was disabled."
88 if [ "$RELOAD" = "YES" ]; then
89 echo "Make sure to restart Icinga 2 for these changes to take effect."