This commit is contained in:
adri
2017-12-13 16:18:41 +01:00
parent 3e47cdaeec
commit ed0934435b
3 changed files with 46 additions and 15 deletions

23
backhome Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/bash
CURDate=$(date "+%Y%m%d%H%M")
FileName=$CURDate"APACHE"
DIR="./"
DIRHOME=$HOME
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 [ ! -x "$DIRHOME" ]; then
echo "Vous n'avez pas les droit pour accéder à $DIRHOME"
exit -1
fi
tar -czf "$DIR/$FileName.tar.gz" $DIRHOME