Skip to content

Instantly share code, notes, and snippets.

@vinodc
Created May 24, 2016 03:51
Show Gist options
  • Select an option

  • Save vinodc/fcfc0068d32f73c550d1c332a97dfa28 to your computer and use it in GitHub Desktop.

Select an option

Save vinodc/fcfc0068d32f73c550d1c332a97dfa28 to your computer and use it in GitHub Desktop.

Revisions

  1. vinodc created this gist May 24, 2016.
    44 changes: 44 additions & 0 deletions vmfusion.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    #!/bin/sh

    # Modified version of:
    # http://tech.namshi.com/blog/2015/08/02/vmware-fusion-headless/
    # See above for adding `vmrun` to your path.

    if [ -z "$vmFile" -a -f *.vmx ]
    then
    vmFile=`ls *.vmx | head -n 1`
    echo "vmFile set to $vmFile."
    fi

    if [ -z "$vmFile" ]
    then
    echo "Please set your 'vmFile' environment variable to point to your vm's .vmx file."
    exit 1
    fi

    case "$1" in
    start)
    vmrun start "$vmFile" nogui
    ;;
    stop)
    vmrun stop "$vmFile" nogui
    ;;
    suspend)
    vmrun suspend "$vmFile" nogui
    ;;
    pause)
    vmrun pause "$vmFile" nogui
    ;;
    unpause)
    vmrun unpause "$vmFile" nogui
    ;;
    reset)
    vmrun reset "$vmFile" nogui
    ;;
    status)
    vmrun list
    ;;
    *)
    echo "Usage: possible options are: start | stop | suspend | pause | unpause | reset | status"
    exit 1
    esac