Commit 5bd6cbf7 authored by System Administrator's avatar System Administrator Committed by Vitaly Lipatov

fix expiration date in sites_on_host03.sh

parent 86113320
......@@ -60,6 +60,10 @@ check_dir()
check_dirs()
{
if [ ! -d $SESSIONDIR ] && [ -d $USERTMPDIR/session/$DOMAINNAME ] ; then
mkdir -p $HOMEDIR/sessions/
mv -v $USERTMPDIR/session/$DOMAINNAME $SESSIONDIR
fi
for i in HOSTBASE LOGDIR USERTMPDIR SESSIONDIR SITEDIR ; do
check_dir $i
done
......
......@@ -34,6 +34,8 @@ get_aliaslist()
# needs: DOMAINNAME
create_site_config()
{
local conffile=
local siteport=
local aliaslist=
# for get space before
[ -n "$ALIASLIST" ] && aliaslist=" $ALIASLIST"
......@@ -50,24 +52,26 @@ fi
local PHPINCLUDE=/etc/httpd2/conf/include
[ -r $PHPINCLUDE/prepend.php ] || echo "<?php putenv('TMPDIR='.ini_get('upload_tmp_dir'));" >$PHPINCLUDE/prepend.php
[ -n "$SITEPORT" ] || SITEPORT=":80"
[ -n "$APACHECONF" ] || APACHECONF=$DOMAINNAME.conf
siteport="$SITEPORT"
[ -n "$siteport" ] || siteport=":80"
conffile="$APACHECONF"
[ -n "$conffile" ] || conffile=$DOMAINNAME.conf
cat <<EOF >$APACHECONF.new
cat <<EOF >$conffile.new
# Autogenerated by $0
# DO NOT CHANGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN!
EOF
if [ -n "$FLAG" ] && [ -n "$SITEPORT" ] ; then
cat <<EOF >>$APACHECONF.new
NameVirtualHost *$SITEPORT
if [ -n "$FLAG" ] && [ -n "$siteport" ] ; then
cat <<EOF >>$conffile.new
NameVirtualHost *$siteport
EOF
fi
cat <<EOF >>$APACHECONF.new
cat <<EOF >>$conffile.new
# ----- $1 -----
<VirtualHost *$SITEPORT>
<VirtualHost *$siteport>
ServerName $DOMAINNAME
ServerAlias www.$DOMAINNAME $TECHALIAS$aliaslist
AssignUserID $USERNAME $USERNAME
......@@ -84,7 +88,7 @@ cat <<EOF >>$APACHECONF.new
</VirtualHost>
EOF
rewrite_if_changed $APACHECONF.new $APACHECONF
rewrite_if_changed $conffile.new $conffile
}
......
......@@ -12,10 +12,10 @@ cd /etc/httpd2/conf/sites-enabled || exit
LISTCONF="*.conf"
[ -n "$*" ] && LISTCONF="$*"
for i in $LISTCONF ; do
test -L $i && continue
for conffile in $LISTCONF ; do
test -L $conffile && continue
parse_site_config $i
parse_site_config $conffile
set_vars
......
#!/bin/bash
echo obsoleted
exit
function getUserName() {
echo $(grep -i -w DocumentRoot "$1" | sed -e "s/^.*DocumentRoot \"\/home\/\(.*\)\/www\/\(.*\)\"/\1/g")
}
......
......@@ -59,7 +59,7 @@ function checkEterhostNetmask() {
netmask=$(echo "$2" | sed "s/\(.*\)\/\(.*\)/\2/g")
if [ "$(ipcalc "$1/$netmask" | grep Network: | awk '{print $2}')" != "$2" ]
if [ "$(ipcalc "$1/$netmask" | grep Network: | awk '{print $2}')" != "$2" ] #"
then
return 1
fi
......@@ -70,7 +70,16 @@ function checkEterhostNetmask() {
function getExpirationTime() {
if [ $# -ne 1 ]; then FatalError "wrong number of arguments"; fi
echo $(whois "$1" | grep -e "\(Expiration Date\|paid-till\)" | sed -e "s/\(Expiration Date\|paid-till\):\(.*\)/\2/g" | awk '{print $1}')
#input emapmle:
# whois borbazaveru.info Expiration Date:13-Aug-2014 12:14:41 UTC
# whois svetinjebraniceva.rs Expiration date: 01.12.2014 18:19:27
# Domain Expiration Date:18-Nov-2014 18:20:50 UTC
# for whois removes 3rd domen name: 3d.2d.ru -> 2d.ru
echo $(whois `sed "s/.*\.\([^\.]*\.[a-z]*\)/\1/g" <<<"$1"` \
| grep -m 1 -e "\(Expiration \(D\|d\)ate\|paid-till\)" \
| sed -e "s/\(\(Domain Expiration\|Expiration\) \(D\|d\)ate\|paid-till\):\(.*\)/\4/g" | awk '{print $1}')
}
function getServerName() {
......@@ -82,7 +91,7 @@ function getServerName() {
function getUserName() {
if [ $# -ne 1 ]; then FatalError "wrong number of arguments"; fi
echo $(grep -i -w DocumentRoot "$1" | sed -e "s/^.*DocumentRoot \"\/home\/\(.*\)\/www\/\(.*\)\"/\1/g")
echo $(grep -i -w DocumentRoot "$1" | sed -e "s/^.*DocumentRoot \"\/home\/\(.*\)\/www\/\(.*\)\"/\1/g") #"
}
function getSiteIpByDomain() {
......@@ -96,7 +105,12 @@ function SaveSite() {
((Counts[$1]++))
eval "Sites${ArrayParts[$1]}[${Counts[$1]}]=\"\$2\""
eval "Users${ArrayParts[$1]}[${Counts[$1]}]=\"\$3\""
eval "Exp${ArrayParts[$1]}[${Counts[$1]}]=\"\$4\""
if [ -n "$4" ]; then
eval "Exp${ArrayParts[$1]}[${Counts[$1]}]=\"\$4\""
else
eval "Exp${ArrayParts[$1]}[${Counts[$1]}]=\"Not_avalible\""
fi
}
function OutputResultList() {
......@@ -148,6 +162,7 @@ function OutputResultList() {
Eterhost="91.232.225.0/24 212.176.200.16/28 89.104.102.0/28 87.249.47.40/29"
cd "/etc/httpd2/conf/sites-enabled"
#cd "/root/etersoft-admin-essential/web/my_test/sites"
OK=0
DELETED=1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment