[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [TEKNIK] Et lille script til test



Ok. Jeg starter med de første par linier i scriptet.

> #!/bin/bash
> set -x
>
> USERARRAY=$(ls -l --format=single-column /home/)

Hvorfor -l --format=single-column ? IKke nødvendigt og
faktisk er USERARRAY slet ikke nødvedigt.

> for USRNME in sslug@sslug

Erstat med:

for USERNAME in /home/*

> do
>  USRDOMNARRAY=$(ls -l --format=single-column /home/$USRNME/PUBLIC_HTML/)
>  for USRDOMN in sslug@sslug

Igen ikke nødvendigt, bare skriv
for USERDOMAIN in /home/$USERNAME/PUBLIC_HTML/*

>  do
>  echo $USRDOMN $USRNME
>  DOT='.'
>  MNDOMN='juac.dk'
>  LNK=$(echo ${USRDOMN}${DOT}${USRNME}${DOT}${MNDOMN})

Drop variablen DOT og skriv linien om til:

LINK=$USERDOMAIN.$USERNAME.$MYDOMAIN

>  IP=$(echo 90${DOT}184${DOT}106${DOT}85)

Igen $(echo er vildt overkill. Skriv om til:

IP=90.18.106.85

>  DIR=home/$USRNME/PUBLIC_HTML

Her mangler vist en / foran home, så linien
skal være:
DIR=/home/$USERNAME/PUBLIC_HTML


>  if [ ! -d ${DIR} ];
>  then
>    mkdir ${DIR}
>  done

??? if skal overslutte med fi ikke done. Skriv de fire linier om til:
mkdir $DIR 2>/dev/null


>  done
> exit
>  fi



>  exec /usr/sbin/a2ensite ${LNK}

argh. Ved du hvad exec gør ? Den erstatter det kørende program dvs.
din shell med et andet program. Det ønsker du ikke.
Bare skriv
/usr/sbin/a2ensite $LINK


>  SPACE=' '
>  WWW='www'
>  echo $(echo ${IP}${SPACE}${WWW}${DOT}${LNK}${SPACE}${LNK}) >> /etc/hosts

Igen bare skriv:
echo "$IP www.$LINK $LINK" >> /etc/hosts


>  exec /etc/init.d/apache2 reload

nej aldrig exec og nok heller ikke reload men graceful og du
ønsker nok at teste om apacheconfig er korrekt før du genindlæser
konfig. Så ændre til:

/usr/sbin/apachectl configtest && /usr/sbin/apachectl graceful

>  dbpasswd=`mkpasswd qwerty`

Brug $( istedet for. Det er mere læseligt.
Dvs.
DBPASSWORD=$(mkpasswd qwerty)



Ret alle fejlene og vend tilbage for flere gode råd.

Hilsen
Martin


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2011-05-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *