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
f16bd60b
Commit
f16bd60b
authored
Feb 17, 2014
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve sites functions
parent
28b2bf28
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
12 deletions
+35
-12
add_site.sh
web/add_site.sh
+1
-1
config.template
web/config.template
+3
-0
create_sep_sites.sh
web/create_sep_sites.sh
+3
-2
functions
web/functions
+3
-2
functions-apache
web/functions-apache
+20
-2
refresh_site_conf.sh
web/refresh_site_conf.sh
+3
-3
restore_site_dump.sh
web/restore_site_dump.sh
+2
-2
No files found.
web/add_site.sh
View file @
f16bd60b
...
...
@@ -42,7 +42,7 @@ fi
#mkdir -p $SITE/cgi
mkdir
-p
$SITEDIR
$SESSIONDIR
chown
$USERNAME
$SESSIONDIR
/
chown
$USERNAME
:root
$SESSIONDIR
/
#mkdir -p $LOGDIR
#test -f $SITE/favicon.ico || cp -f ./favicon.ico $SITE/favicon.ico
...
...
web/config.template
View file @
f16bd60b
...
...
@@ -17,3 +17,6 @@ MAINNAME=azbyka
# Каталог основного сайта:
MAINSITEDIR=/home/$MAINNAME/www/$MAINDOMAIN
# /home dir for upstream servers
HOMEDIR=/var/lib/vz/private/azbyka/home
web/create_sep_sites.sh
View file @
f16bd60b
...
...
@@ -9,7 +9,8 @@ fatal()
}
cat
create_sep_sites.list |
grep
-v
"#"
|
while
read
PORT URL
;
do
NAME
=
$(
basename
$URL
)
[
-n
"
$PORT
"
]
||
continue
NAME
=
$(
basename
$URL
)
||
fatal
"Empty URL in the list"
[
-L
"
$MAINSITEDIR
/
$NAME
"
]
&&
{
echo
"Skipping
$NAME
"
;
continue
;
}
echo
echo
"Creating conf for
$NAME
..."
...
...
@@ -31,7 +32,7 @@ cat create_sep_sites.list | grep -v "#" | while read PORT URL ; do
fi
fi
test
-d
/home/
$SEPUSER
&&
fatal
"
$SEPUSER
already created"
export
HACKCOMMONDIR
=
"/home/azbyka/www/azbyka.ru/include:/home/azbyka/www/azbyka.ru/orphus"
export
HACKCOMMONDIR
=
"
:
/home/azbyka/www/azbyka.ru/include:/home/azbyka/www/azbyka.ru/orphus"
cat
<<
EOF
========
$SEPUSER
============
...
...
web/functions
View file @
f16bd60b
...
...
@@ -10,6 +10,7 @@ set_vars()
SESSIONDIR=$HOMEDIR/sessions/$DOMAINNAME
TECHNAME=`echo $DOMAINNAME | sed -e "s|\..*||g"`
TECHALIAS=$TECHNAME.$TECHHOST
[ -n "$FLAG" ] && TECHALIAS=
SITEDIR=$HOSTBASE/$DOMAINNAME
}
...
...
@@ -31,8 +32,8 @@ set_dirperms()
# www/sites
chown $USERNAME:webmaster $HOSTBASE/*
chmod -v 0770 $HOSTBASE/*
chmod -v
g+s
$HOSTBASE/*
# g+s, +t
chmod -v
3770
$HOSTBASE/*
# log
mkdir -p $LOGDIR
...
...
web/functions-apache
View file @
f16bd60b
...
...
@@ -57,6 +57,12 @@ siteport="$SITEPORT"
conffile="$APACHECONF"
[ -n "$conffile" ] || conffile=$DOMAINNAME.conf
if [ -n "$FLAG" ] && [ -n "$OPENBASEDIR" ]; then
HACKCOMMONDIR="$(echo "$OPENBASEDIR" | sed -e "s|$SITEDIR:$USERTMPDIR:$PHPINCLUDE:/tmp||g")"
else
HACKCOMMONDIR=
fi
cat <<EOF >$conffile.new
# Autogenerated by $0
# DO NOT CHANGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN!
...
...
@@ -75,10 +81,12 @@ cat <<EOF >>$conffile.new
ServerName $DOMAINNAME
ServerAlias www.$DOMAINNAME $TECHALIAS$aliaslist
AssignUserID $USERNAME $USERNAME
# does error?
#MaxClientsVHost 8
php_admin_value session.save_path "$SESSIONDIR"
# Due http://drupal.stackexchange.com/questions/10646/i-get-tmp-is-not-writeable-by-the-webserver-on-migration
# NOTE: /tmp for open_basedir
php_admin_value open_basedir "$SITEDIR:$USERTMPDIR:$PHPINCLUDE:/tmp
:
$HACKCOMMONDIR"
php_admin_value open_basedir "$SITEDIR:$USERTMPDIR:$PHPINCLUDE:/tmp$HACKCOMMONDIR"
php_admin_value upload_tmp_dir "$USERTMPDIR"
php_admin_value auto_prepend_file "$PHPINCLUDE/prepend.php"
ServerAdmin $ADMINMAIL
...
...
@@ -99,13 +107,23 @@ parse_site_config()
DOMAINNAME=$(get_var $i ServerName | tr [A-Z] [a-z])
USERNAME=$(get_var $i AssignUserID | cut -f1 -d" ")
[ -n "$DOMAINNAME" ] || fatal
# keep config name
APACHECONF=$i
echo
echo "*** File $i, site: $DOMAINNAME, user: $USERNAME"
if [ "$(basename $i)" != "$DOMAINNAME.conf" ] ; then
if [ "$(basename $i)" != "$DOMAINNAME.conf" ]
&& [ "$(basename $i)" != "$USERNAME.conf" ]
; then
fatal "$i: file conf name and site name are not equal!"
fi
if [ "$(basename $i)" = "$USERNAME.conf" ] ; then
FLAG=yes
OPENBASEDIR=$(get_var $i "php_admin_value open_basedir")
else
FLAG=
OPENBASEDIR=
fi
ALIASLIST=$(get_aliaslist $i)
[ -z "$ALIASLIST" ] || echo " Alias list: $ALIASLIST"
}
web/refresh_site_conf.sh
View file @
f16bd60b
...
...
@@ -12,10 +12,10 @@ cd /etc/httpd2/conf/sites-enabled || exit
LISTCONF
=
"*.conf"
[
-n
"
$*
"
]
&&
LISTCONF
=
"
$*
"
for
c
onf
file
in
$LISTCONF
;
do
test
-L
$c
onf
file
&&
continue
for
cfile
in
$LISTCONF
;
do
test
-L
$cfile
&&
continue
parse_site_config
$c
onf
file
parse_site_config
$cfile
set_vars
...
...
web/restore_site_dump.sh
View file @
f16bd60b
...
...
@@ -9,7 +9,7 @@ VEID=`echo $(cat /proc/user_beancounters | grep kmemsize | cut -f1 -d:)`
.
./config
RBCONTDIR
=
$BACKUPDIR
/
var/lib/vz/private/
$VEID
RBCONTDIR
=
$BACKUPDIR
/
$HOMEDIR
echo
"Restore from
$RBCONTDIR
"
HUSER
=
$1
...
...
@@ -24,5 +24,5 @@ BDATE=$3
BACKUPDIR
=
/home/
$HUSER
/restored-backup
mkdir
-p
$BACKUPDIR
||
exit
RESTOREDIR
=
$RBCONTDIR
/
home/
$HUSER
/www/
$RSITE
RESTOREDIR
=
$RBCONTDIR
/
$HUSER
/www/
$RSITE
rdiff-backup
-r
$BDATE
backup::
$RESTOREDIR
$BACKUPDIR
/
$(
basename
$RSITE
)
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