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
3e4fcd9b
Commit
3e4fcd9b
authored
Apr 11, 2017
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update createbytask
parent
63205798
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
17 deletions
+62
-17
base.task
vz/azbyka/base.task
+3
-0
createbylist.sh
vz/azbyka/createbylist.sh
+16
-0
createbytask.int.sh
vz/azbyka/createbytask.int.sh
+15
-1
createbytask.sh
vz/azbyka/createbytask.sh
+28
-16
No files found.
vz/azbyka/base.task
View file @
3e4fcd9b
...
...
@@ -10,3 +10,6 @@ PHP_max_execution_time=15
# Site
DOMAIN=site.azbyka.ru
# Original container
VEIDORIG=193
vz/azbyka/createbylist.sh
0 → 100755
View file @
3e4fcd9b
#!/bin/sh
CONFDIR
=
/vz/root/900/etc/nginx/sites-enabled.d/azbyka.d
#for task in crosswords miloserdie propovedi katehizacija ; do
for
task
in
fiction zdorovie rabota news
;
do
veid
=
$(
grep
sites80
$CONFDIR
/
$task
.conf |
sed
-e
"s|.*//sites80
\(
[0-9][0-9]
\)
.*|
\1
|"
)
[
-n
"
$veid
"
]
||
{
echo
"skip
$task
"
;
continue
;
}
cat
<<
EOF
>task.task
VEID=1
$veid
NAME=
$task
EOF
cat
task.task
#continue
./createbytask.sh task.task
done
vz/azbyka/createbytask.int.sh
View file @
3e4fcd9b
...
...
@@ -6,13 +6,23 @@ fatal()
exit
1
}
# TODO
assure
()
{
[
-n
"
$1
"
]
||
fatal
"empty"
}
TASK
=
"
$1
"
[
-s
"
$TASK
"
]
||
fatal
.
$TASK
assure
$AUSER
tune_php7
()
{
local
aphp
=
/etc/php/7.1/apache2-mod_php/php.ini
# FIXME: php version
PHPVERSION
=
7.1
local
aphp
=
/etc/php/PHPVERSION/apache2-mod_php/php.ini
#[ -s php7.add ] && cat php7.add | st tee -a $aphp
[
-n
"
$PHP_memory_limit
"
]
&&
subst
"s|^memory_limit =.*|memory_limit =
$PHP_memory_limit
|"
$aphp
[
-n
"
$PHP_max_execution_time
"
]
&&
subst
"s|^max_execution_time = .*|max_execution_time =
$PHP_max_execution_time
|"
$aphp
...
...
@@ -31,6 +41,10 @@ cat <<EOF > /etc/httpd2/conf/mods-available/remoteip.conf
EOF
ln
-sr
/etc/httpd2/conf/mods-available/remoteip.conf /etc/httpd2/conf/mods-enabled/remoteip.conf
# TODO
cp
/tmp/
$AUSER
.conf /etc/httpd2/conf/sites-enabled/
$AUSER
.conf
||
fatal
cp
/tmp/prepend.php /etc/httpd2/conf/include/prepend.php
||
fatal
subst
"s|^NameVirtualHost.*||g"
/etc/httpd2/conf/sites-enabled/
$AUSER
.conf
subst
"s|^<VirtualHost.*|<VirtualHost *:80>|g"
/etc/httpd2/conf/sites-enabled/
$AUSER
.conf
...
...
vz/azbyka/createbytask.sh
View file @
3e4fcd9b
...
...
@@ -17,26 +17,27 @@ if [ -s "base.task" ] ; then
fi
TASK
=
"
$1
"
[
-n
"
$TASK
"
]
||
TASK
=
php7.task
#[ -n "$TASK" ] || TASK=php7.task
#[ -n "$TASK" ] || TASK=php7.task
[
-s
"
$TASK
"
]
||
fatal
.
$TASK
# detect name by filename
[
-n
"
$NAME
"
]
||
NAME
=
$(
basename
$TASK
.task
)
# TODO
#STARTVEID=101
#VEID=101
VEIP
=
192.168.3.
$VEID
#VEIDORIG=193
AUSER
=
azbyka_
$NAME
assure
$NAME
assure
$VEID
assure
$VEIDORIG
if
!
vzlist
-a
|
grep
$VEIP
;
then
vzctl create
$VEID
--ostemplate
=
$TEMPLATE
vzctl
set
$VEID
--name
$NAME
--hostname
$NAME
.
$DOMAIN
--onboot
yes
--ipadd
$VEIP
--save
vzctl
set
$VEID
--shmpages
300M
--physpages
1G
--privvmpages
2G
--tcprcvbuf
unlimited
--kmemsize
40M:45M
--numproc
512
--dcachesize
unlimited
--save
if
!
vzlist
-a
|
grep
"
$VEIP
"
;
then
vzctl create
$VEID
--ostemplate
=
$TEMPLATE
||
fatal
vzctl
set
$VEID
--name
$NAME
--hostname
$NAME
.
$DOMAIN
--onboot
yes
--ipadd
$VEIP
--save
||
fatal
vzctl
set
$VEID
--shmpages
300M
--physpages
1G
--privvmpages
2G
--tcprcvbuf
unlimited
--kmemsize
40M:45M
--numproc
512
--dcachesize
unlimited
--save
||
fatal
fi
if
[
!
-s
/etc/vz/conf/
$VEID
.mount
]
;
then
...
...
@@ -66,19 +67,30 @@ st()
}
# TODO
cat
/var/lib/vz/root/193/etc/httpd2/conf/sites-enabled/azbyka_
$NAME
.conf | st
tee
/etc/httpd2/conf/sites-enabled/azbyka_
$NAME
.conf
cat
/var/lib/vz/root/193/etc/httpd2/conf/include/prepend.php | st
tee
/etc/httpd2/conf/include/prepend.php
cat
/var/lib/vz/root/
$VEIDORIG
/etc/httpd2/conf/sites-enabled/
$AUSER
.conf | st
tee
/tmp/
$AUSER
.conf
# /etc/httpd2/conf/sites-enabled/$AUSER.conf || fatal
cat
/var/lib/vz/root/
$VEIDORIG
/etc/httpd2/conf/include/prepend.php | st
tee
/tmp/prepend.php
# etc/httpd2/conf/include/prepend.php || fatal
cat
createbytask.int.sh | st
tee
/tmp/createbytask.int.sh
st
chmod
0755 /tmp/createbytask.int.sh
# copy task into
ATASK
=
/tmp/
$(
basename
$TASK
)
cat
$TASK
| st
tee
$ATASK
(
[
-s
"base.task"
]
&&
cat
base.task
;
echo
;
cat
$TASK
;
)
| st
tee
$ATASK
# if we detected it before
echo
"NAME=
$NAME
"
| st
tee
-a
$ATASK
echo
"AUSER=
$AUSER
"
| st
tee
-a
$ATASK
echo
"AUSERID=
$(
vzctl
exec
$VEIDORIG
id
-u
$AUSER
)
"
| st
tee
-a
$ATASK
echo
"AGROUPID=
$(
vzctl
exec
$VEIDORIG
id
-g
$AUSER
)
"
| st
tee
-a
$ATASK
auserid
=
$(
vzctl
exec
$VEIDORIG
id
-u
$AUSER
)
[
-n
"
$auserid
"
]
||
fatal
"can't get user id"
echo
"AUSERID=
$auserid
"
| st
tee
-a
$ATASK
agroupid
=
$(
vzctl
exec
$VEIDORIG
id
-g
$AUSER
)
[
-n
"
$agroupid
"
]
||
fatal
"can't get group id"
echo
"AGROUPID=
$agroupid
"
| st
tee
-a
$ATASK
#echo "WEBMASTER=$(vzctl exec $VEIDORIG id -g $AUSER)" | st tee -a $ATASK
cat
createbytask.int.sh | st
tee
/tmp/createbytask.int.sh
st
chmod
0755 /tmp/createbytask.int.sh
st /tmp/createbytask.int.sh
$ATASK
||
fatal
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