[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



Eller kan dette skrives i et PHP-script sådan at det afvikles på serveren evt. i terminal som root og senere i et cron job?
evt. ved brug af system(""); kommandoen?
Men vil system("") vil den afvikles på serveren eller klienten?
Thomas

"Thomas Rosendal Jensen" skrev i meddelelsen news:sslug@sslug

tak :)

Thomas

Martin Møller Skarbiniks Pedersen wrote:
Hej Thomas,
  Hvad ønsker du hjælp til ?
  Jeg tror kraftigt at du skal koncentere dig om at få
scriptet til at virke korrekt, som det første.

  Jeg vil prøve at få tid i morgen til at sende en liste over
en del åbenlyse fejl.

Mvh
Martin

On 13 April 2011 17:49, Thomas Rosendal Jensen <sslug@sslug> wrote:
Her er så et spæd forsøg på at lave følgende:

Jeg har brug for et script til at opsætte hver enkelte elev subdomain
således:

http://<Elevens Valgte Prefix>.<Elevens Brugernavn>.<Webstedets
Hostname>.<Top Level Domain>/

fx: http://test1.tony.wbhotl.dk/

test1 ligger så i /home/tony/PUBLIC_HTML/test1/

Det skal så med ssh kunne lade sig gøre at komme i kontakt med:
”/home/tony/www/test1.tony.wbhotl.dk/index.php”

Desuden er det nødvendigt af der opsættes en MySQL database for hvert
subdomain, med at valgt password 'mkpasswd qwerty'

fx. navn på MySQL databasen: “test1.tony.wbhotl.dk” fx. med ellevens
password valgt

Mit system er for skrøbeligt, synes jeg, til at jeg kan køre det selv endnu.
(Det er endnu uden, en mulighed for at fjerne en konto indbygget.)
Måske nogle af jer der fx. har en virtual machine med Linux, Apache, PHP og
MySQL, som det ikke gør så meget går i stykker, kan køre det.

Her koden.

Thomas :)


#!/bin/bash
set -x

USERARRAY=$(ls -l --format=single-column /home/)
for USRNME in sslug@sslug
do
 USRDOMNARRAY=$(ls -l --format=single-column /home/$USRNME/PUBLIC_HTML/)
 for USRDOMN in sslug@sslug
 do
 echo $USRDOMN $USRNME
 DOT='.'
 MNDOMN='juac.dk'
 LNK=$(echo ${USRDOMN}${DOT}${USRNME}${DOT}${MNDOMN})
 IP=$(echo 90${DOT}184${DOT}106${DOT}85)
 DIR=home/$USRNME/PUBLIC_HTML
 if [ ! -d ${DIR} ];
 then
   mkdir ${DIR}
 done
 done
exit
 fi
 if [ ! -d /usr/lib/cgi-bin/${LNK}];
 then
   mkdir "/usr/lib/cgi-bin/${LNK}"
 fi
 if [ ! -d /etc/apache2/sites-available/${LNK}];
 then
  echo '<VirtualHost *:80>
 ServerAdmin sslug@sslug
 ServerName www.${LNK}
 ServerAlias ${LNK}
 DocumentRoot ${DIR}/${USRDOMN}
 # Set Document Root directory options
 <Directory />
   Options FollowSymlnks -Indexes Includes
   # Allow use of .htaccess file
   AllowOverride Limit FileInfo
 </Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/${LNK}
 # Set CGI-BIN directory options
 <Directory /cgi-bin>
   AllowOverride None
   Options +ExecCGI -Multiviews +SymlnksIfOwnerMatch
   Order allow,deny
   Allow from all
 </Directory>
 CustomLog /var/log/apache2/access.log common
 ErrorLog /var/log/apache2/error.log
</VirtualHost>' > '/etc/apache2/sites-available/${LNK}'
 exec /usr/sbin/a2ensite ${LNK}
 SPACE=' '
 WWW='www'
 echo $(echo ${IP}${SPACE}${WWW}${DOT}${LNK}${SPACE}${LNK}) >> /etc/hosts
 exec /etc/init.d/apache2 reload
 dbpasswd=`mkpasswd qwerty`
 mysqladmin create ${LNK} -uroot -p${dbpasswd}
echo 'The username of the database ${LNK} is root. And the password for the
database is ${dbpasswd}' > '${DIR}/${LNK}.database.txt'
 fi
 done
 done

# end script








 
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] *