aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xvbox16
1 files changed, 14 insertions, 2 deletions
diff --git a/vbox b/vbox
index 2b93f1f..4cea401 100755
--- a/vbox
+++ b/vbox
@@ -36,6 +36,19 @@ function vbox_run {
VBoxManage $command $VM $*
}
+# Initialize clipboard service
+function vbox_clip {
+ local instances="`ps -o pid,command -e | grep "VBoxClient --clipboard" | cut -d ' ' -f 2 | xargs`"
+
+ # Kill old instances
+ for pid in instances; do
+ kill -9 $pid &> /dev/null
+ done
+
+ VBoxClient --clipboard
+ exit
+}
+
# Build options
if [ ! -z "$VM" ]; then
if [ "$COMMAND" == "up" ]; then
@@ -66,8 +79,7 @@ elif [ "$COMMAND" == "list" ]; then
VBoxManage list runningvms
exit
elif [ "$COMMAND" == "clip" ]; then
- VBoxClient --clipboard
- exit
+ vbox_clip
else
usage
fi