checkforrunningvms revision 343053a42dedb94c8ef5534fff89c72384adf94d
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#!/bin/sh
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# Copyright (C) 2008-2010 Oracle Corporation
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# available from http://www.virtualbox.org. This file is free software;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# you can redistribute it and/or modify it under the terms of the GNU
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# General Public License (GPL) as published by the Free Software
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncGREP=/usr/bin/grep
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncPS=/bin/ps
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncRESULT=0
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync# Check if there are running vms
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncPROCS=`${PS} -e | ${GREP} -E "VirtualBoxVM.*startvm|VBoxNetDHCP" | ${GREP} -v grep`
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncif [ "${PROCS}x" != "x" ]; then
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync RESULT=1;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncfi
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncexit $RESULT
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync