smf-vboxwebsrv.sh revision c315c89581ef4e2ce4240d4346a33d04d0299693
204c10a47f2896a5472f9477a6f93ccc3a90a3f4vboxsync# Copyright (C) 2008 Sun Microsystems, Inc.
204c10a47f2896a5472f9477a6f93ccc3a90a3f4vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
204c10a47f2896a5472f9477a6f93ccc3a90a3f4vboxsync# available from http://www.virtualbox.org. This file is free software;
204c10a47f2896a5472f9477a6f93ccc3a90a3f4vboxsync# you can redistribute it and/or modify it under the terms of the GNU
204c10a47f2896a5472f9477a6f93ccc3a90a3f4vboxsync# General Public License (GPL) as published by the Free Software
204c10a47f2896a5472f9477a6f93ccc3a90a3f4vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
204c10a47f2896a5472f9477a6f93ccc3a90a3f4vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
204c10a47f2896a5472f9477a6f93ccc3a90a3f4vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
204c10a47f2896a5472f9477a6f93ccc3a90a3f4vboxsync# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
204c10a47f2896a5472f9477a6f93ccc3a90a3f4vboxsync# Clara, CA 95054 USA or visit http://www.sun.com if you need
204c10a47f2896a5472f9477a6f93ccc3a90a3f4vboxsync# additional information or have any questions.
204c10a47f2896a5472f9477a6f93ccc3a90a3f4vboxsync# smf-vboxwebsrv method
204c10a47f2896a5472f9477a6f93ccc3a90a3f4vboxsync# Argument is the method name (start, stop, ...)
204c10a47f2896a5472f9477a6f93ccc3a90a3f4vboxsync echo "ERROR: /opt/VirtualBox/vboxwebsrv does not exist."
204c10a47f2896a5472f9477a6f93ccc3a90a3f4vboxsync echo "ERROR: /opt/VirtualBox/vboxwebsrv does not exist."
c315c89581ef4e2ce4240d4346a33d04d0299693vboxsync # Get svc configuration
c315c89581ef4e2ce4240d4346a33d04d0299693vboxsync VW_USER=`/usr/bin/svcprop -p config/user $SMF_FMRI 2>/dev/null`
c315c89581ef4e2ce4240d4346a33d04d0299693vboxsync VW_HOST=`/usr/bin/svcprop -p config/host $SMF_FMRI 2>/dev/null`
c315c89581ef4e2ce4240d4346a33d04d0299693vboxsync VW_PORT=`/usr/bin/svcprop -p config/port $SMF_FMRI 2>/dev/null`
c315c89581ef4e2ce4240d4346a33d04d0299693vboxsync # Provide sensible defaults
204c10a47f2896a5472f9477a6f93ccc3a90a3f4vboxsync [ -z "$VW_PORT" -o "$VW_PORT" -eq 0 ] && VW_PORT=18083
fecf6ed6bcd1186078b5b49423a73c9da7ef2c3bvboxsync su "$VW_USER" -c "LOGNAME=\"$VW_USER\" USER=\"$VW_USER\" /opt/VirtualBox/vboxwebsrv --background --host \"$VW_HOST\" --port \"$VW_PORT\""
204c10a47f2896a5472f9477a6f93ccc3a90a3f4vboxsync echo "vboxwebsrv failed with $VW_EXIT."
204c10a47f2896a5472f9477a6f93ccc3a90a3f4vboxsync # Kill service contract