Changeset 9098:3b2c04fffbea in orange


Ignore:
Timestamp:
10/12/11 14:23:46 (3 years ago)
Author:
matija <matija.polajnar@…>
Branch:
default
Convert:
aa5051e1e6cb652f27a38b6314933131fa51b88e
Message:

Update vmware start-stop routines in addons packaging.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • install-scripts/vmware/vmware-dailyrun-addon-packaging.sh

    r9093 r9098  
    66VMRUN='/Library/Application Support/VMware Fusion/vmrun' 
    77VMIMAGE='/Volumes/Data/vmware/Orange\ Add-on\ Packaging/Orange\ Add-on\ Packaging.vmx' 
    8 WAIT_TIME=3600 
     8WAIT_START_TIME=300 
     9WAIT_STOP_TIME=600 
     10IP_ADDRESS='172.16.213.134' 
    911NAME='Orange Add-on Packaging' 
    1012 
    11 # Sets error handler 
    12 trap "echo \"Script failed\"" ERR 
     13# We use public/private keys SSH authentication so no need for a password 
    1314 
    1415start_vmware() { 
    15     if "$VMRUN" list | grep -q "$VMIMAGE"; then 
    16         echo "[$NAME] VMware is already running." 
    17         exit 1 
    18     fi 
    19      
    20     # We hide some Mac OS X warnings which happen if nobody is logged into a host Mac OS X 
    21     "$VMRUN" start "$VMIMAGE" nogui 2>&1 | grep -i -v 'Untrusted apps are not allowed to connect to or launch Window Server before login' | grep -i -v 'FAILED TO establish the default connection to the WindowServer' | grep -i -v 'kCGErrorFailure' | true 
    22     # PIPESTATUS check is needed so that we test return value of the VMRUN and not grep 
    23     # (which would be otherwise checked because of the -e switch, with true at the end of the pipe we ignore it) 
    24     if ((${PIPESTATUS[0]})); then false; fi 
    25  
    26     return 0 
     16    if "$VMRUN" list | grep -q "$VMIMAGE"; then 
     17        echo "[$NAME] VMware is already running." 
     18        exit 1 
     19    fi 
     20     
     21    # We hide some Mac OS X warnings which happen if nobody is logged into a host Mac OS X 
     22    "$VMRUN" start "$VMIMAGE" nogui 2>&1 | grep -i -v 'Untrusted apps are not allowed to connect to or launch Window Server before login' | grep -i -v 'FAILED TO establish the default connection to the WindowServer' | grep -i -v 'kCGErrorFailure' 
     23    ps=("${PIPESTATUS[@]}") 
     24    # PIPESTATUS check is needed so that we test return value of the VMRUN and not grep 
     25    if ((${ps[0]})); then 
     26        echo "[$NAME] Could not start VMware." 
     27        exit 2 
     28    fi 
     29     
     30    # Wait for VMware and OS to start 
     31    sleep $WAIT_START_TIME 
     32     
     33    return 0 
    2734} 
    2835 
    2936stop_vmware() { 
    30     # Wait for VMware and OS to start 
    31     sleep $WAIT_TIME 
    32      
    33     if "$VMRUN" list | grep -q "$VMIMAGE"; then 
    34         echo "[$NAME] Had to force shutdown." 
    35         # We hide some Mac OS X warnings which happen if nobody is logged into a host Mac OS X 
    36         "$VMRUN" stop "$VMIMAGE" nogui 2>&1 | grep -i -v 'Untrusted apps are not allowed to connect to or launch Window Server before login' | grep -i -v 'FAILED TO establish the default connection to the WindowServer' | grep -i -v 'kCGErrorFailure' | true 
    37         # PIPESTATUS check is needed so that we test return value of the VMRUN and not grep 
    38         # (which would be otherwise checked because of the -e switch, with true at the end of the pipe we ignore it) 
    39         if ((${PIPESTATUS[0]})); then false; fi 
    40     fi 
    41      
    42     return 0 
     37    ssh root@$IP_ADDRESS "/sbin/shutdown -h now > /dev/null" 
     38     
     39    # Wait for OS to stop 
     40    sleep $WAIT_STOP_TIME 
     41     
     42    if "$VMRUN" list | grep -q "$VMIMAGE"; then 
     43        echo "[$NAME] Have to force shutdown." 
     44        # We hide some Mac OS X warnings which happen if nobody is logged into a host Mac OS X 
     45        "$VMRUN" stop "$VMIMAGE" nogui 2>&1 | grep -i -v 'Untrusted apps are not allowed to connect to or launch Window Server before login' | grep -i -v 'FAILED TO establish the default connection to the WindowServer' | grep -i -v 'kCGErrorFailure' | true 
     46        ps=("${PIPESTATUS[@]}") 
     47        # PIPESTATUS check is needed so that we test return value of the VMRUN and not grep 
     48        if ((${ps[0]})); then 
     49            echo "[$NAME] Could not stop VMware." 
     50            exit 3 
     51        fi 
     52    fi 
     53     
     54    return 0 
    4355} 
    4456 
Note: See TracChangeset for help on using the changeset viewer.