Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
6b9f274b
Commit
6b9f274b
authored
Apr 03, 2014
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spice-example-sh: add parameter parser
As suggested by Michael in the forum.
parent
82599a65
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
5 deletions
+52
-5
spice-example-sh
spice-example-sh
+52
-5
No files found.
spice-example-sh
View file @
6b9f274b
...
@@ -2,13 +2,60 @@
...
@@ -2,13 +2,60 @@
# needs pve-manager >= 3.1-44
# needs pve-manager >= 3.1-44
USERNAME
=
root@pam
usage
()
{
PASSWORD
=
yoursecretpassword
echo
"Usage:
$0
[-u <string>] [-p <string>] vmid [node [proxy]]"
echo
echo
"-u username. Default root@pam"
echo
"-p password. Default ''"
echo
echo
"vmid: id for VM"
echo
"node: Proxmox cluster node name"
echo
"proxy: DNS or IP (use <node> as default)"
exit
1
}
PASSWORD
=
""
USERNAME
=
""
while
getopts
":u:p:"
o
;
do
case
"
${
o
}
"
in
u
)
USERNAME
=
${
OPTARG
}
;;
p
)
PASSWORD
=
${
OPTARG
}
;;
*
)
usage
;;
esac
done
shift
$((
OPTIND-1
))
if
[
-z
$PASSWORD
]
;
then
PASSWORD
=
""
fi
if
[
-z
$USERNAME
]
;
then
USERNAME
=
root@pam
fi
DEFAULTHOST
=
$(
hostname
-f
)
# select VM
# select VM
VMID
=
100
[
-z
$1
]
&&
usage
VMID
=
$1
#[ -z $2 ] && usage
NODE
=
${
2
:-
$DEFAULTHOST
}
if
[
-z
$3
]
;
then
PROXY
=
$NODE
else
PROXY
=
$3
fi
NODE
=
anodename
NODE
=
${
NODE
%%\.*
}
PROXY
=
anodename.domain.tld
DATA
=
`
curl
-k
-d
"username=
$USERNAME
&password=
$PASSWORD
"
https://
$PROXY
:8006/api2/json/access/ticket
`
DATA
=
`
curl
-k
-d
"username=
$USERNAME
&password=
$PASSWORD
"
https://
$PROXY
:8006/api2/json/access/ticket
`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment