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

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

We do use "$2 and so on" in invirt-vmcontrol

  • Property svn:executable set to *
File size: 1.2 KB
Line 
1#!/bin/bash
2# invirt-vmcontrol MACHINE ACTION
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#
9# $2 and so on are user-provided, and thus sketchy.
10
11ORIGMACHINE="$1"
12ACTION="$2"
13MACHINE="d_$ORIGMACHINE"
14
15case "$ACTION" in
16    list|vcpu-list|uptime)
17        xm "$ACTION" "$MACHINE"
18        ;;
19    destroy|shutdown|reboot)
20        xm "$ACTION" "$MACHINE"
21        /usr/sbin/invirt-update-conserver </dev/null >/dev/null 2>&1 &
22        ;;
23    install|create)
24        shift; shift;
25        xm list "$MACHINE" >/dev/null 2>/dev/null && echo "$MACHINE already exists" && exit 1
26        if [ "$ACTION" = "install" ]; then
27            xm create invirt-database machine_name="$ORIGMACHINE" installer_options="$(printf '%q ' "$@")"
28        elif [ -n "$1" ]; then
29            xm create invirt-database machine_name="$ORIGMACHINE" cdrom_image="$1"
30        else
31            xm create invirt-database machine_name="$ORIGMACHINE"
32        fi
33        (sleep 4; /usr/sbin/invirt-update-conserver) </dev/null >/dev/null 2>&1 &
34        ;;
35    list-long)
36        xm list --long "$MACHINE"
37        ;;
38    vnctoken)
39        invirt-vnc-authtoken "$ORIGMACHINE"
40        ;;
41    *)
42        echo "ERROR: Invalid Command"
43        exit 34
44        ;;
45esac
Note: See TracBrowser for help on using the repository browser.