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
5a56feed
Commit
5a56feed
authored
Mar 08, 2020
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add fill_args_list and use it intead of copy-paste code
parent
0dad37db
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
117 deletions
+37
-117
evz-docker
bin/evz-docker
+5
-19
evz-functions
bin/evz-functions
+18
-0
evz-pct
bin/evz-pct
+4
-34
evz-qm
bin/evz-qm
+3
-8
evz-vboxmanage
bin/evz-vboxmanage
+3
-20
evz-vzctl
bin/evz-vzctl
+4
-36
No files found.
bin/evz-docker
View file @
5a56feed
...
...
@@ -102,9 +102,10 @@ case $CMD in
done
;;
set
)
# HELPCMD: set param. Use with --option param
fill_args_list
"
$@
"
for
i
in
$LIST
;
do
info
"Do
$CMD
on
$i
..."
todo
vzctl
$CMD
$i
$OPTIONS
--save
#
info "Do $CMD on $i ..."
todo
docmdeval
$CMD
$i
"
$OPTARGS
"
--save
done
;;
ubc|resources|show
)
# HELPCMD: print resource using
...
...
@@ -149,24 +150,9 @@ case $CMD in
info
"See evz ports ID for print ports"
;;
exec
)
# HELPCMD: execute command by list (all for all containers)
###################################
# the same code like in set)
# get all args until ids or all/ALL
LIST
=
""
if
arg_is_all
"
$1
"
;
then
LIST
=
"
$(
get_list
"
$1
"
)
"
shift
else
while
[
-n
"
$1
"
]
;
do
arg_is_id
"
$1
"
||
break
LIST
=
"
$LIST
$1
"
shift
done
fi
###################################
fill_args_list
"
$@
"
for
i
in
$LIST
;
do
docmd
docker
exec
-ti
$SETLANG
"
$i
"
"
$@
"
docmd
eval docker
exec
-ti
$SETLANG
"
$i
"
"
$QUOTEDARGS
"
done
;;
enter
)
# HELPCMD: enter in a container with ID
...
...
bin/evz-functions
View file @
5a56feed
...
...
@@ -74,3 +74,21 @@ quote_args()
done
}
# will fill LIST with ids and QUOTEDARGS with other
fill_args_list
()
{
# get all args until ids or all/ALL
LIST
=
""
if
arg_is_all
"
$1
"
;
then
LIST
=
"
$(
get_list
"
$1
"
)
"
shift
else
while
[
-n
"
$1
"
]
;
do
arg_is_id
"
$1
"
||
break
LIST
=
"
$LIST
$1
"
shift
done
fi
QUOTEDARGS
=
"
$(
quote_args
"
$@
"
)
"
}
bin/evz-pct
View file @
5a56feed
...
...
@@ -102,25 +102,10 @@ case $CMD in
done
;;
set
)
# HELPCMD: set param. Use with --option param
###################################
# the same code like in set)
# get all args until ids or all/ALL
LIST
=
""
if
arg_is_all
"
$1
"
;
then
LIST
=
"
$(
get_list
"
$1
"
)
"
shift
else
while
[
-n
"
$1
"
]
;
do
arg_is_id
"
$1
"
||
break
LIST
=
"
$LIST
$1
"
shift
done
fi
###################################
fill_args_list
"
$@
"
for
i
in
$LIST
;
do
info
"Do
$CMD
on
$i
..."
docmd
pct
set
$i
"
$@
"
docmd
eval pct
set
$i
"
$QUOTEDARGS
"
done
;;
ubc|resources|show
)
# HELPCMD: print resource using
...
...
@@ -184,24 +169,9 @@ case $CMD in
#info "See evz ports ID for print ports"
;;
exec
)
# HELPCMD: execute command by list (all for all containers)
###################################
# the same code like in set)
# get all args until ids or all/ALL
LIST
=
""
if
arg_is_all
"
$1
"
;
then
LIST
=
"
$(
get_list
"
$1
"
)
"
shift
else
while
[
-n
"
$1
"
]
;
do
arg_is_id
"
$1
"
||
break
LIST
=
"
$LIST
$1
"
shift
done
fi
###################################
fill_args_list
"
$@
"
for
i
in
$LIST
;
do
docmd pct
exec
"
$i
"
"
$
@
"
docmd pct
exec
"
$i
"
"
$
QUOTEDARGS
"
done
;;
enter
)
# HELPCMD: enter in a container with ID
...
...
bin/evz-qm
View file @
5a56feed
...
...
@@ -100,12 +100,9 @@ case $CMD in
done
;;
set
)
# HELPCMD: set param. Use with --option param
OPTIONS
=
"
$1
$2
"
shift
2
LIST
=
"
$(
get_list
"
$@
"
)
"
fill_args_list
"
$@
"
for
i
in
$LIST
;
do
info
"Do
$CMD
on
$i
..."
todo vzctl
$CMD
$i
$OPTIONS
--save
docmd vzctl
$CMD
$i
"
$QUOTEDARGS
"
--save
done
;;
ubc|resources|show
)
# HELPCMD: print resource using
...
...
@@ -150,9 +147,7 @@ case $CMD in
fi
;;
exec
)
# HELPCMD: execute command by list (all for all containers)
INCMD
=
"
$1
"
shift
LIST
=
"
$(
get_list
"
$@
"
)
"
fill_args_list
"
$@
"
for
i
in
$LIST
;
do
todo showcmd docker
exec
-ti
$SETLANG
"
$i
"
"
$INCMD
"
#a= docker exec -ti $SETLANG "$i" "$INCMD"
...
...
bin/evz-vboxmanage
View file @
5a56feed
...
...
@@ -104,26 +104,11 @@ case $CMD in
done
;;
set
)
# HELPCMD: set param. Use with --option param
###################################
# the same code like in set)
# get all args until ids or all/ALL
LIST
=
""
if
arg_is_all
"
$1
"
;
then
LIST
=
"
$(
get_list
"
$1
"
)
"
shift
else
while
[
-n
"
$1
"
]
;
do
arg_is_id
"
$1
"
||
break
LIST
=
"
$LIST
$1
"
shift
done
fi
###################################
fill_args_list
"
$@
"
# show help if empty
[
-n
"
$LIST
"
]
||
docmd vboxmanage modifyvm
for
i
in
$LIST
;
do
docmd
vboxmanage modifyvm
$i
"
$@
"
docmd
eval vboxmanage modifyvm
$i
"
$QUOTEDARGS
"
done
;;
ubc|resources|show
)
# HELPCMD: print resource using by virtual machine(s)
...
...
@@ -185,9 +170,7 @@ case $CMD in
fi
;;
exec
)
# HELPCMD: execute command by list (all for all virtual machines)
INCMD
=
"
$1
"
shift
LIST
=
"
$(
get_list
"
$@
"
)
"
fill_args_list
"
$@
"
for
i
in
$LIST
;
do
todo showcmd docker
exec
-ti
$SETLANG
"
$i
"
"
$INCMD
"
todo
a
=
docker
exec
-ti
$SETLANG
"
$i
"
"
$INCMD
"
...
...
bin/evz-vzctl
View file @
5a56feed
...
...
@@ -80,23 +80,9 @@ case $CMD in
done
;;
set
)
# HELPCMD: set param. Use with --option param
###################################
# get all args until ids or all/ALL
LIST
=
""
if
arg_is_all
"
$1
"
;
then
LIST
=
"
$(
get_list
"
$1
"
)
"
shift
else
while
[
-n
"
$1
"
]
;
do
arg_is_id
"
$1
"
||
break
LIST
=
"
$LIST
$1
"
shift
done
fi
###################################
fill_args_list
"
$@
"
for
i
in
$LIST
;
do
docmd
vzctl
$CMD
$i
"
$@
"
--save
docmd
eval vzctl
set
$i
"
$QUOTEDARGS
"
--save
done
;;
ubc|resources|show
)
# HELPCMD: print resource using via vzubc
...
...
@@ -141,27 +127,9 @@ case $CMD in
fi
;;
exec
)
# HELPCMD: execute command by list (all for all containers)
###################################
# the same code like in set)
# get all args until ids or all/ALL
LIST
=
""
if
arg_is_all
"
$1
"
;
then
LIST
=
"
$(
get_list
"
$1
"
)
"
shift
else
while
[
-n
"
$1
"
]
;
do
arg_is_id
"
$1
"
||
break
LIST
=
"
$LIST
$1
"
shift
done
fi
###################################
fill_args_list
"
$@
"
for
i
in
$LIST
;
do
#info "Executing on $i ..."
#printf "%3d: %s" $i "$(vzctl exec $i "$INCMD")"
#vzctl exec $i "$INCMD" | sed -e "s|^|$(printf "%3d: " $i)|g"
docmd vzctl
exec
$i
"
$@
"
docmdeval vzctl
exec
$i
"
$QUOTEDARGS
"
done
;;
enter
)
# HELPCMD: enter in a container with ID
...
...
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