Bash script to aid command line tools

Discussion in 'Installation and Configuration of Parallels Desktop' started by dvessel, Sep 10, 2012.

  1. dvessel

    dvessel Bit poster

    Messages:
    2
    Hello there.

    Heres a little bash script so you dont have to remember the full name or UUID number when working with the command line tool `prlctl`. Im not all that good with bash so use at your own risk. This was written for Parallels 8.

    https://gist.github.com/3689527

    It accepts all the commands `prlctl` does but instead of passing in the full name or UUID, just pass in part of the name or its status. When multiple matches are found, the script will prompt you for a selection.

    Theres also an extra `ip` command to return the ip number which was tested only in Ubuntu. Useful for ssh, e.g., "ssh name@`prl ip running`

    I needed this because Im trying to setup a workflow where Parallels runs headless and that means using the command line tools. Managing names/UUIDs was not much fun.
     
  2. dvessel

    dvessel Bit poster

    Messages:
    2
    I updated the script. It’s now extensible with bash aliases and external functions. The idea is to have handy commands that can do simple or complex things but keep it separated from the core function of the script which is targeting vm’s.

    It no longer accepts all `prlctl` commands. It only allows commands that focuses on a single vm at a time.

    Here’s the usage pattern:
    Code:
    Usage:
      prlvm <command> [-a,--all][-t,--template] <search vm_[name|status]> [OPTIONS]
    List commands:
      prlvm [-c,--commands]
    List virtual machines:
      prlvm [-l,--list]
    
    The -a flag will target all matching vm’s without prompting you. Without this flag, it will always focus on a single instance. When multiple matches are found, it will prompt you for a selection.

    example (suspend all running vm’s):
    Code:
    prlvm suspend -a running
    
    The -t flag targets templates. These are kept separate from normal vm’s.

    The -c flag will list all acceptable commands. This includes the internal `prlctl` commands, aliases and custom functions. The latter two will have an asterisk marked next to their names.

    The -l flag will list all virtual machines. Running vm’s will be colored.

    It was a painful learning experience. I’ll eventually push it into a full github project.
     
    Last edited: Sep 13, 2012

Share This Page