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
7cd0e923
Commit
7cd0e923
authored
Sep 20, 2014
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit last changes
parent
7c28163d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
6 deletions
+30
-6
clone_vz.sh
vz/clone_vz.sh
+9
-4
config
vz/config
+2
-1
update_cloned_vz.sh
vz/update_cloned_vz.sh
+19
-1
No files found.
vz/clone_vz.sh
View file @
7cd0e923
...
...
@@ -9,24 +9,30 @@ fi
.
./config
HOMEDIR
=
/var/lib/vz/private/azbyka/home
FROM
=
/var/lib/vz/private/
$1
TO
=
/var/lib/vz/private/
$2
CFGDIR
=
/etc/vz/conf
rsync
-avPH
--exclude
"/home/"
$FROM
/
$TO
/
# FIXME: it is better to hold /home out of container
mkdir
-p
$TO
/home
VEID
=
$2
mkdir
-p
/var/lib/vz/root/
$VEID
/
cp
$CFGDIR
/
$1
.conf
$CFGDIR
/
$
2
.conf
cp
$CFGDIR
/
$1
.conf
$CFGDIR
/
$
VEID
.conf
cat
<<
EOF
>
$CFGDIR
/
$2
.mount
#!/bin/bash
# Mount script to bind-mount /var/something into a VPS
export VEID=\
$(
basename
\$
0 .mount
)
. /etc/vz/vz.conf
mount --bind
/var/lib/vz/private/
$1
/home
/var/lib/vz/root/\
$VEID
/home
mount --bind
$HOMEDIR
/var/lib/vz/root/\
$VEID
/home
EOF
chmod
u+x
$CFGDIR
/
$2
.mount
#добавить замену ИП в конфиге
\ No newline at end of file
subst
"s|^IP_ADDRESS=
\"
192.168.3.*|IP_ADDRESS=
\"
192.168.3.
$VEID
\"
|g"
$CFGDIR
/
$VEID
.conf
echo
"Start update_cloned_vz.sh now"
vz/config
View file @
7cd0e923
FROMCONT=193
TOCONT="198 201"
TOCONT="189 198 199 201 202 203 204 205 206 207 208 209"
TOHOST=azbykar
# get IP from vz config
get_vzip()
...
...
vz/update_cloned_vz.sh
View file @
7cd0e923
...
...
@@ -2,6 +2,20 @@
.
./config
fix_phpconf
()
{
local
TO
=
"
$1
"
local
PCD
for
i
in
5.5 5.4 5.3
;
do
PCD
=
"
$TO
/etc/php/
$i
/apache2-mod_php/php.ini"
if
[
-r
"
$PCD
"
]
;
then
subst
"s|^memory_limit =.*|memory_limit = 386M|g"
$PCD
subst
"s|^date.timezone =.*|date.timezone ='Europe/Moscow'|g"
$PCD
break
fi
done
}
update_cloned
()
{
local
TOCONT
=
$1
...
...
@@ -10,7 +24,9 @@ ROOTSYS=/var/lib/vz/private
FROM
=
$ROOTSYS
/
$FROMCONT
TO
=
$ROOTSYS
/
$TOCONT
rsync
-av
--progress
--delete-after
$FROM
/etc/httpd2/conf/sites-enabled/
$TO
/etc/httpd2/conf/sites-enabled/
fix_phpconf
$TO
rsync
-av
--progress
--delete-after
$FROM
/etc/httpd2/conf/
$TO
/etc/httpd2/conf/
rsync
-av
--progress
--delete-after
$FROM
/etc/monitrc.d/
$TO
/etc/monitrc.d/
rsync
-av
--progress
--delete-after
$FROM
/etc/tcb/
$TO
/etc/tcb/
rsync
-av
--progress
--delete-after
$FROM
/etc/postfix/
$TO
/etc/postfix/
...
...
@@ -32,6 +48,8 @@ vzctl exec $TOCONT serv monit reload
vzctl
exec
$TOCONT
serv postfix reload
}
[
-n
"
$1
"
]
&&
TOCONT
=
$1
# by list
for
cont
in
$TOCONT
;
do
update_cloned
$cont
...
...
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