APACHE zend framework vhost

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName sub.domain.tld
        SetEnv APPLICATION_ENV "development"
        DocumentRoot /var/www/sub.domain.tld/public
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/sub.domain.tld/public>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Allow from all
        </Directory>
 
        ErrorLog /var/log/apache2/sub.domain.tld.error.log
        CustomLog /var/log/apache2/sub.domain.tld.access.log combined
</VirtualHost>

NGINX zend framework vhost

server {
  listen 80;
 
  server_name sub.domain.tld;
  root /var/www/sub.domain.tld/public;
 
  error_log /var/log/nginx/sub.domain.tld.error.log;
  access_log /var/log/nginx/sub.domain.tld.access.log;
 
  location / {
    index index.php;
    if (-f $request_filename) {
      break;
    }
    rewrite ^(.*)$ /index.php last;
  }
 
  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  #
  location ~ index.php {
    root /var/www/sub.domain.tld/public;
    fastcgi_param APPLICATION_ENV development;
    include fastcgi_params;
    fastcgi_pass   127.0.0.1:9000;
  }
}

scp_sync.sh

#!/bin/bash                                                                                                                                                                                                      
# BASE CONFIGURATION                                                                                                                                                                                             
file_dir="/home/erelance/Drop_Off"
done_dir="/home/erelance/done"
dest_dir="/home/erelance/Drop_Off"
log_dir="/home/erelance/log"
# log                                                                                                                                                                                                            
date_short="+%d-%m-%Y"
date_long="+%d-%m-%Y %H:%M:%S"
log_file="$log_dir/error-"$(date "$date_short")".log"
 
if [ ! -d "$done_dir" ];then
    mkdir "$done_dir"
fi
 
if [ ! -d "$log_dir" ];then
    mkdir "$log_dir"
fi
 
for i in $(ls $file_dir/*.{csv,txt})
do
    scp_return=$(scp $i erelance@sub.domain.tld:$dest_dir 2>&1)
    if [[ $? == 0 ]]; then
        mv $i $done_dir
    else
        echo $(date "$date_long")"|$i|$scp_return" >> $log_file
    fi
done
 
find $log_dir -maxdepth 1 -type f -mtime +14 -name *.log -exec rm {} \; 2>&1

deploy.sh

#!/bin/bash
 
function usage {
    echo "Usage:"
    echo "$0 --all|-a website"
    echo "$0 --sync|-s website"
    echo "$0 --deploy|-d website"
}
 
case $2 in
    'website')
	project_repository="http://repository.ctld/website/trunk/"
	dir="/home/hio/repository/website.com/"
	prod_dir="/home/www/website.com/"
	exclude_list=".svn frontend_test.php frontend_dev.php auth.php backend_dev.php"
        ;;
    *)
        usage
        exit 1
esac
 
if [[ $1 == "--all" || $1 == "-a" ]]; then
    $0 --sync $2
    $0 --deploy $2
fi
 
if [[ $1 == "--sync" || $1 == "-s" ]]; then    
    if [ ! -d "$project_repository" ]; then
	svn co $project_repository $dir
    else
	svn up $dir
    fi
fi
 
for e in $exclude_list
do
    excludes="$excludes --exclude '$e'"
done
 
if [[ $1 == "--deploy" || $1 == "-d" ]]; then
    rsync="sudo rsync -rha --stats $excludes $dir $prod_dir"
    echo $rsync
    eval $rsync
    sudo chown www-data:www-data -R $prod_dir
fi

memo mdadm

Déclarer un disque défaillant et le retirer du raid

mdadm --manage /dev/md2 --set-faulty /dev/sdb1
mdadm --manage /dev/md2 --remove /dev/sdb1

Stopper un raid

mdadm --stop /dev/md2
mdadm --remove /dev/md2

Rajouter/remplacer un disque dans un raid et resynch

mdadm --assemble /dev/md2 /dev/sdb1

Information sur un raid

mdadm --detail /dev/md2

Sauvegarder la conf mdadm

mdadm --detail --scan --verbose >> /etc/mdadm/mdadm.conf

Générer CSR

openssl req -nodes -newkey rsa:2048 -keyout server.key -out server.csr
Country Name (2 letter code) [AU]: FR
State or Province Name (full name) [Some-State]: .
Locality Name (eg, city) []: Town
Organization Name (eg, company) [Internet Widgits Pty Ltd]: company
Organizational Unit Name (eg, section) []: IT
Common Name (eg, YOUR name) []: www.website.tld
Email Address []:
A challenge password []: 
An optional company name []:
cat server.csr

mass_update.sh

#!/bin/bash                                                                                                                                                                                                                                  
hosts="hio@host1.com hio@host2.com hio@host3.com hio@host4.com hio@host5.com"
cmd="echo 'updating ...';sudo aptitude update >> /dev/null;sudo aptitude safe-upgrade -y;echo 'done'"
 
for i in $hosts
do
    echo "###### connecting to $i ..."
    ssh -t $i $cmd
    echo ""
done

install_symfony2.sh

#!/bin/bash
function usage {
    echo "Usage:"
    echo "$0 /home/www/mySf2Project"
}
 
if [[ $1 == "" ]]; then
    usage
    exit 1
fi
 
cd $1
 
if [ -d "app/" ]; then
    echo "already installed, do a <git pull> if you want an update :)"
    exit 1
fi
 
git clone git://github.com/symfony/symfony-standard.git
 
mv symfony-standard/* .
mv symfony-standard/.git* .
 
rmdir symfony-standard
 
bash bin/vendors.sh && php bin/build_bootstrap.php
 
echo "chmod -R 777 app/cache/ app/logs/"
chmod -R 777 app/cache/ app/logs/
 
exit 0