#!/bin/bash CURDate=$(date "+%Y%m%d%H%M") FileName=$CURDate"APACHE" DIR="./" DIRAPACHE="/var/www" if [ $# -gt 0 ] ; then DIR=$1 fi if [ ! -d $DIR ]; then mkdir $DIR fi if [ ! -d "$DIR" ] || [ ! -x "$DIR" ]; then echo "Vous n'avez pas les droit pour accéder à $DIR" exit -1 fi if [ ! -d "$DIRAPACHE" ] || [ ! -x "$DIRAPACHE" ]; then echo "Vous n'avez pas les droit pour accéder à $DIRAPACHE" exit -1 fi tar -czf "$DIR/$FileName.tar.gz" $DIRAPACHE