J
jodalein
Grünschnabel
Habe mir ein Script geschrieben was mir automatisch die Vhost cfgs und ftp user anlegt.
Aber beim Starten des Scriptes kommt immer diese Meldung:
"./automate-vhost.sh: Zeile 1: #!/bin/bash: Datei oder Verzeichnis nicht gefunden"
Das Script läuft ohne Probleme bis zum Ende durch und macht alles was es machen soll, aber ich bekomme den Fehler nicht weg.
Es sind auch keine Windowssteuerzeichen o.ä. vorhanden
Danke und Gruß,
jodalein
Aber beim Starten des Scriptes kommt immer diese Meldung:
"./automate-vhost.sh: Zeile 1: #!/bin/bash: Datei oder Verzeichnis nicht gefunden"
Das Script läuft ohne Probleme bis zum Ende durch und macht alles was es machen soll, aber ich bekomme den Fehler nicht weg.
Es sind auch keine Windowssteuerzeichen o.ä. vorhanden
Danke und Gruß,
jodalein
Code:
#!/bin/bash
################ ALIAS ################
function serveralias
{
if [ "$ALIASASK" = "y" ] || [ "$ALIASASK" = "Y" ] ; then
echo "Please type aliasses ([url]www.Domain.de[/url], *.Domain.com, Domain.* ..)"
read ALIASINSERT
fi
}
################ VHOST ################
function make_vhost
{
cat <<- _VHOST_
<VirtualHost 212.117.86.203:80>
DocumentRoot /var/www/$VHOST
ServerName www.$VHOST.$TDL
_VHOST_
}
function make_alias
{
# Set Serveraliases if given.
for i in $ALIASINSERT ;do
SERVERALIAS=$(echo "ServerAlias" $i )
echo " "$SERVERALIAS
done
}
function make_vhost2
{
cat <<- _VHOST2_
IndexOptions FancyIndexing
IndexIgnore *
AddDefaultCharset utf-8
<Directory /var/www/$VHOST>
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<IfModule mod_php5.c>
php_admin_flag safe_mode_gid off
php_admin_flag register_globals off
php_value sendmail_from [email]ftpuser@domain.de[/email]
</IfModule>
<IfModule mod_php4.c>
php_admin_flag safe_mode_gid off
php_admin_flag register_globals off
php_value sendmail_from [email]ftpuser@domain.de[/email]
</IfModule>
ErrorLog /var/log/apache2/${VHOST}_err
CustomLog /var/log/apache2/${VHOST}_acc combined
<VirtualHost>
_VHOST2_
}
################ WEBALIZER ################
function make_weblog
{
cat <<- _WEBLOG_
# webalizer conf file für www.$VHOST.$TDL...
# basic information
LogFile /var/log/apache2/VHOST_acc
OutputDir /var/www/$VHOST/webalizer
ReportTitle Webstatistik für Firmenname:
HostName www.$VHOST.$TDL
# types to be considered a page
PageType htm*
PageType cgi
PageType php*
PageType pl
# html looking
HTMLPre <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//DE">
HTMLHead <META NAME="author" CONTENT="domain">
HTMLBody <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF0000">
HTMLPost <center><img src="http://www.domain.de/bilder/logo-weiss-farbe.jpg">
HTMLPost <BR><a href="index.html">[Übersicht]</a>
HTMLPost <BR CLEAR="all">
HTMLTail <a href="http://www.domain.de" target=_blank>domain</a>
HTMLEnd </BODY></HTML>
# no status reports good with usage as cron job
Quiet yes
ReallyQuiet yes
# timelimit between to hits = visit
VisitTimeout 1800
# number bakground lines in graphs
GraphLines 4
# number to be displayed
TopSites 50
TopKSites 10
TopURLs 50
TopKURLs 10
TopReferrers 50
TopAgents 15
TopCountries 30
TopEntry 10
TopExit 10
TopSearch 20
TopUsers 20
# Hide sites
HideSite domain.domain.de
HideSite localhost
HideReferrer domain.domain.de/
# Usually you want to hide these
HideURL *.gif
HideURL *.GIF
HideURL *.jpg
HideURL *.JPG
HideURL *.png
HideURL *.PNG
HideURL *.ra
HideURL *.swf
# You can also hide based on authenticated username
HideUser root
HideUser admin
# Grouping options
GroupURL /cgi-bin/* CGI Scripts
GroupURL /images/* Images
GroupReferrer yahoo.com/ Yahoo!
GroupReferrer excite.com/ Excite
GroupReferrer infoseek.com/ InfoSeek
GroupReferrer webcrawler.com/ WebCrawler
GroupReferrer web.de/ Web.de
GroupReferrer lycos.de/ Lycos
GroupReferrer fireball.de/ Fireball
GroupReferrer altavista.de/ Alta Vista
GroupReferrer google.de/ Google
GroupUser root Admin users
GroupUser admin Admin users
GroupUser wheel Admin users
# The following is a great way to get an overall total
# for browsers, and not display all the detail records.
# (You should use MangleAgent to refine further...)
#GroupAgent MSIE Microsoft Internet Exploder
#HideAgent MSIE
#GroupAgent Mozilla Netscape
#HideAgent Mozilla
IgnoreSite [url]www.domain.de[/url]
IgnoreURL /test*
IgnoreURL /admin*
IgnoreReferrer file:/*
IgnoreUser root
# The SearchEngine keywords allow specification of search engines and
# their query strings on the URL. These are used to locate and report
# what search strings are used to find your site. The first word is
# a substring to match in the referrer field that identifies the search
# engine, and the second is the URL variable used by that search engine
# to define it's search terms.
SearchEngine yahoo.com p=
SearchEngine altavista.com q=
SearchEngine google.com q=
SearchEngine eureka.com q=
SearchEngine lycos.com query=
SearchEngine hotbot.com MT=
SearchEngine msn.com MT=
SearchEngine infoseek.com qt=
SearchEngine webcrawler searchText=
SearchEngine excite search=
SearchEngine netscape.com search=
SearchEngine mamma.com query=
SearchEngine alltheweb.com query=
SearchEngine northernlight.com qr=
Incremental
_WEBLOG_
}
################ .htaccess ################
function make_htaccess
{
cat <<- _HTACCESS_
AuthUserFile /var/www/$VHOST/webalizer/.htpasswd
AuthGroupFile /dev/null
AuthName "$VHOST"
AuthType Basic
<Limit GET POST>
require user domain
require user $VHOST
</Limit>
_HTACCESS_
}
################ .htpasswd ################
function make_htpasswordfile
{
cat <<- _HTPASSWD_
$VHOST:$MD5
_HTPASSWD_
}
if [ $USER != root ]; then
echo "You aren't root! We STOP! Get root or let it be!"
exit 1
fi
#Give Vhost name
echo "Please type Vhost Name (Name = FTPusername):"
read VHOST
#Give TDL
echo "Please type TDL: e.g. de,com:"
read TDL
#Give Serveraliases
echo "Please type \"Y\" if u want Server aliases, if u dont want leave clear. "
read ALIASASK
serveralias
#Give webalizer password
echo "Pleaste type webalizer password:"
read PASS
#Give user Password
echo "Please Type User Password:"
read ftppass
#Give User description
echo "Please Type User description:"
read DESC
#Give uid
echo "Please Type uid:"
read USERNUMMER
################ USER ################
useradd -d "/var/www/$VHOST" -s "/bin/bash" -m -U $USERNUMMER -c "$DESC" -p $PASS $VHOST
################ WEBALIZER ################
#MD5 crypt password for htpasswd
MD5=$(md5pass $PASS)
mkdir /var/www/$VHOST/webalizer
chown -R $VHOST:apache /var/www/$VHOST
make_weblog > /var/www/$VHOST/webalizer/$VHOST.conf
make_htaccess > /var/www/$VHOST/webalizer/.htaccess
make_htpasswordfile > /var/www/$VHOST/webalizer/.htpasswd
################ APACHE2 ################
make_vhost > /etc/apache2/vhosts.d/$VHOST.conf
make_alias >> /etc/apache2/vhosts.d/$VHOST.conf
make_vhost2 >> /etc/apache2/vhosts.d/$VHOST.conf
echo "Wait till Vhost is createt please hold on"
sleep 10
/etc/init.d/apache2 stop
sleep 2
/etc/init.d/apache2 start
Zuletzt bearbeitet: