Create ak-kill-9pserver.sh that kills ufs server
authorEdward Hyunkoo Jee <edjee@google.com>
Tue, 17 Nov 2015 20:58:15 +0000 (12:58 -0800)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 18 Nov 2015 18:37:28 +0000 (10:37 -0800)
Signed-off-by: Edward Hyunkoo Jee <edjee@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
scripts/ak-scripts/ak-kill-9pserver.sh [new file with mode: 0644]
scripts/ak-scripts/ak-launch-9pserver.sh

diff --git a/scripts/ak-scripts/ak-kill-9pserver.sh b/scripts/ak-scripts/ak-kill-9pserver.sh
new file mode 100644 (file)
index 0000000..34df55d
--- /dev/null
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2015 Google Inc.
+# See LICENSE for details.
+
+function short_description() {
+       echo "Kill the Go 9pserver for Akaros with the specified port number"
+}
+
+function usage() {
+       echo "Usage:"
+       echo "    ${cmd} -h | --help"
+       echo "    ${cmd} [ --ufs-port=<port> ]"
+       echo ""
+       echo "Options:"
+       echo "    -h --help               Display this screen and exit"
+       echo "    --ufs-port=<port>       Port the ufs server is on"
+       echo "                            [default: 1025]"
+}
+
+function main() {
+       # Check the sanity of our incoming variables
+       check_vars ufs_port
+
+       # Kill any old instances of the ufs server on ${ufs_port}
+       local ufs_pid=$(ps aux | grep "ufs" | grep "\-addr=:${ufs_port}" \
+                              | head -1 | awk '{print $2}' )
+       if [ "${ufs_pid}" != "" ]; then
+               echo "Killing old 9p server instance on port=${ufs_port} (pid ${ufs_pid})"
+               echo "${ufs_pid}" | xargs kill
+       fi
+}
index 1549eb9..b29540d 100644 (file)
@@ -60,12 +60,7 @@ function main() {
        mkdir -p ${akaros_9p_root}
 
        # Kill any old instances of the ufs server on ${ufs_port}
        mkdir -p ${akaros_9p_root}
 
        # Kill any old instances of the ufs server on ${ufs_port}
-       local ufs_pid=$(ps aux | grep "ufs" | grep "\-addr=:${ufs_port}" \
-                              | head -1 | awk '{print $2}' )
-       if [ "${ufs_pid}" != "" ]; then
-               echo "Killing old 9p server instance on port=${ufs_port} (pid ${ufs_pid})"
-               echo "${ufs_pid}" | xargs kill
-       fi
+       ak kill-9pserver --ufs-port="${ufs_port}"
 
        # Start a new ufs instance on ${ufs_port}
        nohup ${gopath}/bin/ufs -akaros=true -addr=:${ufs_port} \
 
        # Start a new ufs instance on ${ufs_port}
        nohup ${gopath}/bin/ufs -akaros=true -addr=:${ufs_port} \