backup.sh 635 Bytes
Newer Older
1 2
#!/bin/sh

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
COMPLETE=0
DIR=

if [ $# -ge 1 -a "$1" = "-h" ]; then
    echo "$0: [-c] [path]

-c:   Backup everything
path: Where to save the file" >&2
    exit 1
fi

if [ $# -ge 1 -a "$1" = "-c" ]; then
    COMPLETE=1
    shift
fi

if [ $# -ge 1 ]; then
20
    DIR="$1/"
21 22
fi

23
now=$(date +"%Y-%m-%d_%H:%M:%S") 
24
if [ $COMPLETE -eq 1 ]; then
25
        filename="${DIR}backup_"$now
Mathieu Giraud's avatar
Mathieu Giraud committed
26
        zip -r $filename web2py/applications/vidjil/databases/  /mnt/result/results/  /mnt/upload/uploads/
27
else
28
        filename="${DIR}backup_essentials_"$now
Mathieu Giraud's avatar
Mathieu Giraud committed
29
        zip -r $filename web2py/applications/vidjil/databases/  /mnt/result/results/
30 31 32
fi

echo $filename