Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
evz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Тимофей Смирнов
evz
Commits
b7270d1e
Commit
b7270d1e
authored
Nov 17, 2017
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add help
parent
c8c8a6dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
12 deletions
+68
-12
evz
bin/evz
+68
-12
No files found.
bin/evz
View file @
b7270d1e
...
...
@@ -33,10 +33,61 @@ load_helper()
load_helper evz-sh-functions
check_tty
phelp
()
{
echo
"
$Descr
$Usage
Commands:
$(
get_help HELPCMD
)
Options:
$(
get_help HELPOPT
)
Examples:
# evz start ID ID ID
"
}
print_version
()
{
echo
"
$*
"
echo
"Etersoft vzctl wrapper version @VERSION@"
echo
"Copyright (c) Etersoft 2017"
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
}
progname
=
"
${
0
##*/
}
"
Usage
=
"Usage:
$progname
[options] [<command>] [params]..."
Descr
=
"evz - vzctl wrapper"
progname
=
"
${
0
##*/
}
"
force
=
''
target
=
''
verbose
=
--verbose
case
"
$1
"
in
-h
|
--help
|
help
)
# HELPOPT: this help
phelp
exit
;;
-V
|
--version
)
# HELPOPT: print version
print_version
exit
;;
-q
|
--quiet
)
# HELPOPT: be silent
verbose
=
shift
;;
-f
|
--force
)
# HELPOPT: override target
force
=
-f
shift
;;
esac
list_all
()
{
vzlist
-1
...
...
@@ -47,10 +98,12 @@ list_ALL()
vzlist
-1
-a
}
# TODO: add all support for all cases
CMD
=
$1
shift
case
$CMD
in
off
)
off
)
# HELPCMD: stop container(s) and disable start on boot
for
i
in
"
$@
"
;
do
info
"Stopping
$i
..."
vzctl stop
$i
...
...
@@ -58,7 +111,7 @@ case $CMD in
vzctl
set
$i
--onboot
no
--save
done
;;
on
)
on
)
# HELPCMD: enable start on boot and start container(s)
for
i
in
"
$@
"
;
do
info
"Starting
$i
..."
# TODO: check if enabled
...
...
@@ -66,34 +119,37 @@ case $CMD in
vzctl start
$i
done
;;
status
)
status
)
# HELPCMD: print container(s) status
info
"Do
$CMD
for
$*
..."
for
i
in
"
$@
"
;
do
vzctl
$CMD
$i
done
;;
compact
)
compact
)
# HELPCMD: do named operation on container(s)
for
i
in
"
$@
"
;
do
info
"Do
$CMD
on
$i
..."
vzctl
$CMD
$i
done
;;
stop
)
stop
)
# HELPCMD: stop container(s)
for
i
in
"
$@
"
;
do
info
"Stopping
$i
..."
vzctl stop
$i
done
;;
start
)
start
)
# HELPCMD: start container(s)
for
i
in
"
$@
"
;
do
info
"Starting
$i
..."
vzctl start
$i
done
;;
list
)
list
)
# HELPCMD: list avaiable container(s)
# TODO -q for just id list
# TODO -a support
# https://bugs.etersoft.ru/show_bug.cgi?id=12016
vzlist
"
$@
"
;;
exec
)
exec
)
# HELPCMD: execute command by list (all for all containers)
INCMD
=
"
$1
"
shift
LIST
=
"
$*
"
...
...
@@ -106,7 +162,7 @@ case $CMD in
vzctl
exec
$i
"
$INCMD
"
done
;;
info
)
info
)
# HELPCMD: print containers(s) info (vzlist like)
LIST
=
"
$*
"
[
"
$1
"
=
"all"
]
&&
LIST
=
"
$(
list_all
)
"
[
"
$1
"
=
"ALL"
]
&&
LIST
=
"
$(
list_ALL
)
"
...
...
@@ -119,7 +175,7 @@ case $CMD in
vzlist
$LIST
-o
ctid,ip,hostname,diskspace
#done
;;
destroy
)
destroy
)
# HELPCMD: destroy container(s) by list
echo
"You request to destroy follow containers:"
vzlist
"
$@
"
#local response
...
...
@@ -133,6 +189,6 @@ case $CMD in
done
;;
*
)
fatal
"Unknow command '
$CMD
'"
fatal
"Unknow command '
$CMD
'
. Use --help to get help.
"
;;
esac
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