Skip to content

Instantly share code, notes, and snippets.

@MrPink
Created January 16, 2012 17:40
Show Gist options
  • Save MrPink/1621972 to your computer and use it in GitHub Desktop.
Save MrPink/1621972 to your computer and use it in GitHub Desktop.
1 #!/bin/bash
2
3 NAG_DIR='/etc/nagios3/servers'
4
5 case "$1" in
6 enable-mpd)
7 if [ -a $NAG_DIR/mpd.live.cfg ]; then
8 echo "MPD Live already enabled!"
9 exit 1
10 else
11 mv $NAG_DIR/mpd.off.cfg $NAG_DIR/mpd.off
12 mv $NAG_DIR/mpd.live $NAG_DIR/mpd.live.cfg
13 mv $NAG_DIR/enmasse.live $NAG_DIR/enmasse.live.cfg
14 mv $NAG_DIR/umaami.off.cfg $NAG_DIR/umaami.off
15 /etc/init.d/nagios3 restart
16 fi
17 ;;
18
19 disable-mpd)
20 if [ -a $NAG_DIR/mpd.off.cfg ]; then
21 echo "MPD Live already disabled!"
22 exit 1
23 else
24 mv $NAG_DIR/mpd.live.cfg $NAG_DIR/mpd.live
25 mv $NAG_DIR/mpd.off $NAG_DIR/mpd.off.cfg
26 mv $NAG_DIR/enmasse.off.cfg $NAG_DIR/enmasse.off
27 mv $NAG_DIR/umaami.live.cfg $NAG_DIR/umaami.live
28 /etc/init.d/nagios3 restart
29 fi
30 ;;
31
32 *)
33 echo $"Usage: $0 {enable-mpd|disable=-mpd}"
34 exit 1
35
36 esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment