source: trunk/packages/invirt-remote/host/usr/sbin/invirt-vmcontrol @ 1901

Last change on this file since 1901 was 1822, checked in by broder, 16 years ago

Merge invirt-remote-host and invirt-remote-server into invirt-remote

  • Property svn:executable set to *
File size: 1.2 KB
RevLine 
[1097]1#!/bin/bash
[1239]2# invirt-vmcontrol MACHINE ACTION
[121]3#
4# remctl should have already verified that the user is authorized to
5# control the machine.  So, we just need to execute the action requested.
6#
7# $0 and $1 come from the trusted remctl source.
8#
[1759]9# $2 and so on are user-provided, and thus sketchy.
[121]10
[146]11ORIGMACHINE="$1"
[196]12ACTION="$2"
[146]13MACHINE="d_$ORIGMACHINE"
[121]14
15case "$ACTION" in
[386]16    list|vcpu-list|uptime)
[121]17        xm "$ACTION" "$MACHINE"
18        ;;
[1723]19    destroy|shutdown|reboot)
[386]20        xm "$ACTION" "$MACHINE"
[1239]21        /usr/sbin/invirt-update-conserver </dev/null >/dev/null 2>&1 &
[386]22        ;;
[1723]23    install|create)
[1089]24        shift; shift;
[1723]25        xm list "$MACHINE" >/dev/null 2>/dev/null && echo "$MACHINE already exists" && exit 1
[223]26        if [ "$ACTION" = "install" ]; then
[1268]27            xm create invirt-database machine_name="$ORIGMACHINE" installer_options="$(printf '%q ' "$@")"
[1128]28        elif [ -n "$1" ]; then
[1268]29            xm create invirt-database machine_name="$ORIGMACHINE" cdrom_image="$1"
[127]30        else
[1268]31            xm create invirt-database machine_name="$ORIGMACHINE"
[127]32        fi
[1239]33        (sleep 4; /usr/sbin/invirt-update-conserver) </dev/null >/dev/null 2>&1 &
[127]34        ;;
[121]35    list-long)
36        xm list --long "$MACHINE"
37        ;;
[1390]38    vnctoken)
39        invirt-vnc-authtoken "$ORIGMACHINE"
[1397]40        ;;
[121]41    *)
42        echo "ERROR: Invalid Command"
[1167]43        exit 34
[121]44        ;;
45esac
Note: See TracBrowser for help on using the repository browser.