Add openafs-backend, a remctl backend for OpenAFS maintenance
authorRuss Allbery <rra@stanford.edu>
Tue, 13 Oct 2009 02:08:20 +0000 (19:08 -0700)
committerRuss Allbery <rra@stanford.edu>
Tue, 13 Oct 2009 02:08:20 +0000 (19:08 -0700)
openafs/openafs-backend [new file with mode: 0755]

diff --git a/openafs/openafs-backend b/openafs/openafs-backend
new file mode 100755 (executable)
index 0000000..a8f966b
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# openafs-backend -- remctl backend for OpenAFS maintenance.
+#
+# This is a remctl backend for running various OpenAFS maintenance tasks that
+# are managed by openafs.stanford.edu.  Currently, it supports restarting
+# Gerrit and updating the website in AFS.
+
+PATH=/usr/local/bin:/bin:/usr/bin; export PATH
+
+command="$1"
+shift
+case $command in
+    help)
+        echo 'OpenAFS maintenance commands:'
+        echo '  openafs export-web [prod]       Export web pages to AFS'
+        echo '  openafs restart-gerrit          Restart Jetty for Gerrit'
+        exit 0
+        ;;
+    export-web)
+        if [ -n "$1" ] && [ x"$1" != xprod ] ; then
+            echo 'Syntax: openafs export-web [prod]' >&2
+            exit 1
+        fi
+        if [ x"$1" = xprod ] ; then
+            export_htdocs -p
+        else
+            export_htdocs
+        fi
+        ;;
+    restart-gerrit)
+        /etc/init.d/jetty restart
+        sleep 5
+        /etc/init.d/apache restart
+        ;;
+    *)
+        echo "Unknown command $command" >&2
+        exit 1
+        ;;
+esac