misc new stuff
[automated-distro-installer] / faiserver-disable
1 #!/bin/bash
2
3 set -eE -o pipefail
4 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
5
6 usage() {
7 cat <<EOF
8 Usage: ${0##*/}
9 Disable the fai nfs server exports
10 EOF
11 exit $1
12 }
13
14 if [[ $1 ]]; then
15 usage 1
16 fi
17
18 ssh root@$(chost faiserver) bash <<'EOF'
19 set -eE -o pipefail
20 if modprobe nfsd &>/dev/null; then
21 sed -ri --follow-symlinks '\%^/srv/fai/%d' /etc/exports
22 exportfs -ra
23 else
24 rm -f /etc/apache2/sites-enabled/faiserver.conf
25 systemctl reload apache2
26 fi
27 EOF