VirtualBox

Changeset 43656 in vbox for trunk/src/VBox/Installer


Ignore:
Timestamp:
Oct 16, 2012 3:18:28 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
81422
Message:

Autostart/stop: Further work on the stop part

Location:
trunk/src/VBox/Installer
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/darwin/VirtualBox/VBoxAutostartDarwin.sh

    r42384 r43656  
    1818#
    1919
    20 function vboxStartAllUserVms()
     20function vboxStartStopAllUserVms()
    2121{
    2222    # Go through the list and filter out all users without a shell and a
     
    3434        fi
    3535
    36         # Start the daemon
    37         su ${user} -c "/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostart --quiet --start --background --config ${1}"
    38 
     36        case "${1}" in
     37            start)
     38                # Start the daemon
     39                su ${user} -c "/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostart --quiet --start --background --config ${CONFIG}"
     40                ;;
     41            stop)
     42                # Start the daemon
     43                su ${user} -c "/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostart --quiet --stop --config ${CONFIG}"
     44                ;;
     45               *)
     46                echo "Usage: start|stop"
     47                exit 1
     48        esac
    3949    done
    4050}
    4151
    42 case $1 in
    43     --start) vboxStartAllUserVms ${2};;
    44           *) echo "Unknown option ${1}";;
    45 esac
     52function vboxStopAllUserVms()
     53{
     54    vboxStartStopAllUserVms "stop"
     55}
    4656
     57CONFIG=${1}
     58vboxStartStopAllUserVms "start"
     59trap vboxStopAllUserVms HUP KILL TERM
     60
     61
  • trunk/src/VBox/Installer/darwin/VirtualBox/org.virtualbox.vboxautostart.plist

    r42384 r43656  
    1212  <array>
    1313    <string>/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostartDarwin.sh</string>
    14     <string>--start</string>
    1514    <string>/etc/vbox/autostart.cfg</string>
    1615  </array>
  • trunk/src/VBox/Installer/linux/vboxautostart-service.sh

    r43365 r43656  
    291291    [ -z "$VBOXAUTOSTART_CONFIG" ] && exit 0
    292292
    293     exit 0
    294 
    295     #begin_msg "Stopping VirtualBox VMs configured for autostop";
    296     #vboxdrvrunning || {
    297     #    fail_msg "VirtualBox kernel module not loaded!"
    298     #    exit 0
    299     #}
    300     #PARAMS="--stop"
    301     #[ -n "$VBOXAUTOSTART_CONFIG" ] && PARAMS="$PARAMS -c $VBOXAUTOSTART_CONFIG"
     293    PARAMS="--stop --config $VBOXAUTOSTART_CONFIG"
    302294
    303295    # prevent inheriting this setting to VBoxSVC
    304     #unset VBOX_RELEASE_LOG_DEST
    305 
    306     #for user in `ls $VBOXAUTOSTART_DB/*.stop`
    307     #do
    308     #    start_daemon `basename $user | sed -ne "s/\(.*\).stop/\1/p"` $binary $PARAMS > /dev/null 2>&1
    309     #done
    310 
    311     #return $RETVAL
     296    unset VBOX_RELEASE_LOG_DEST
     297
     298    for user in `ls $VBOXAUTOSTART_DB/*.stop`
     299    do
     300        start_daemon `basename $user | sed -ne "s/\(.*\).stop/\1/p"` $binary $PARAMS > /dev/null 2>&1
     301    done
     302
     303    return $RETVAL
    312304}
    313305
  • trunk/src/VBox/Installer/solaris/smf-vboxautostart.sh

    r42491 r43656  
    6565    ;;
    6666    stop)
    67         # Kill service contract
    68         smf_kill_contract $2 TERM 1
     67        if [ ! -x /opt/VirtualBox/VBoxAutostart ]; then
     68            echo "ERROR: /opt/VirtualBox/VBoxAutostart does not exist."
     69            return $SMF_EXIT_ERR_CONFIG
     70        fi
     71
     72        if [ ! -f /opt/VirtualBox/VBoxAutostart ]; then
     73            echo "ERROR: /opt/VirtualBox/VBoxAutostart does not exist."
     74            return $SMF_EXIT_ERR_CONFIG
     75        fi
     76
     77        # Get svc configuration
     78        VW_CONFIG=`/usr/bin/svcprop -p config/config $SMF_FMRI 2>/dev/null`
     79        [ $? != 0 ] && VW_CONFIG=
     80        VW_ROTATE=`/usr/bin/svcprop -p config/logrotate $SMF_FMRI 2>/dev/null`
     81        [ $? != 0 ] && VW_ROTATE=
     82        VW_LOGSIZE=`/usr/bin/svcprop -p config/logsize $SMF_FMRI 2>/dev/null`
     83        [ $? != 0 ] && VW_LOGSIZE=
     84        VW_LOGINTERVAL=`/usr/bin/svcprop -p config/loginterval $SMF_FMRI 2>/dev/null`
     85        [ $? != 0 ] && VW_LOGINTERVAL=
     86
     87        # Provide sensible defaults
     88        [ -z "$VW_CONFIG" ] && VW_CONFIG=/etc/vbox/autostart.cfg
     89        [ -z "$VW_ROTATE" ] && VW_ROTATE=10
     90        [ -z "$VW_LOGSIZE" ] && VW_LOGSIZE=104857600
     91        [ -z "$VW_LOGINTERVAL" ] && VW_LOGINTERVAL=86400
     92
     93        # Get all users
     94        for VW_USER in `logins -g staff`
     95        do
     96            exec su - "$VW_USER" -c "/opt/VirtualBox/VBoxAutostart --stop --config \"$VW_CONFIG\" --logrotate \"$VW_ROTATE\" --logsize \"$VW_LOGSIZE\" --loginterval \"$VW_LOGINTERVAL\""
     97
     98            VW_EXIT=$?
     99            if [ $VW_EXIT != 0 ]; then
     100                echo "VBoxAutostart failed with $VW_EXIT."
     101                VW_EXIT=1
     102                break
     103            fi
     104        done
    69105    ;;
    70106    *)
  • trunk/src/VBox/Installer/solaris/virtualbox-autostart.xml

    r43653 r43656  
    7171            type='method'
    7272            name='stop'
    73             exec=':kill'
    74             timeout_seconds='15'>
     73            exec='/opt/VirtualBox/smf-vboxautostart.sh %m'
     74            timeout_seconds='0'>
    7575            <method_context>
    7676                <method_credential user='root' group='root' />
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette