Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-admin-essentials
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
etersoft-admin-essentials
Commits
baa3bff1
Commit
baa3bff1
authored
Mar 13, 2016
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add vz/clone_vz_to_a01.sh
parent
8a4f587b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
clone_vz_to_a01.sh
vz/clone_vz_to_a01.sh
+52
-0
No files found.
vz/clone_vz_to_a01.sh
0 → 100755
View file @
baa3bff1
#!/bin/bash
# Копирует контейнер в контейнер и конфиг
#добавить проверку числовых значений
#добавить проверку параметра --all
if
[
-z
"
$1
"
]
||
[
-z
"
$2
"
]
;
then
exit
;
fi
#. ./config
HOMEDIR
=
/azbyka
FROM
=
/var/lib/vz/private/
$1
TO
=
/var/lib/vz/private/
$2
CFGDIR
=
/etc/vz/conf
VEID
=
$2
TOHOST
=
a01
#RSYNC="rsync -e \"ssh -c arcfour\""
rsync
-e
"ssh -c arcfour"
-avPH
$FROM
/
$TOHOST
:
$TO
/
||
exit
ssh
$TOHOST
mkdir
-p
/var/lib/vz/root/
$VEID
/
||
exit
scp
$CFGDIR
/
$1
.conf
$TOHOST
:
$CFGDIR
/
$VEID
.conf
||
exit
cat
<<
EOF
| ssh
$TOHOST
tee
$CFGDIR
/
$VEID
.mount >/dev/null
#!/bin/bash
# Mount script to bind-mount /var/something into a VPS
export VEID=\
$(
basename
\$
0 .mount
)
. /etc/vz/vz.conf
mount --bind
$HOMEDIR
/var/lib/vz/root/\
$VEID
/home
EOF
ssh
$TOHOST
chmod
u+x
$CFGDIR
/
$VEID
.mount
##Никаких замен не требуется и утилиты subst на CentOS нет
#AZBYKAMAIN=91.232.225.22
cat
<<
EOF
| ssh
$TOHOST
sh -
#subst "s|^IP_ADDRESS=\"192.168.3.*|IP_ADDRESS=\"192.168.3.
$VEID
\"|g"
$CFGDIR
/
$VEID
.conf
# mysql
##subst "s|192.168.3.191|
$AZBYKAMAIN
|g"
$TO
/etc/hosts
# memcached
# commented, use local memcached
#subst "s|192.168.3.188|
$AZBYKAMAIN
|g"
$TO
/etc/hosts
vzctl start
$VEID
|| exit
sleep 10
vzctl exec
$VEID
nscd -i hosts
EOF
#echo "Start update_cloned_vz.sh now"
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