Add backup script
This commit is contained in:
parent
8d7394b833
commit
15a0c26b91
27
backup.sh
Executable file
27
backup.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd `dirname "$0"`
|
||||
TO_BCKP="/mnt/backup"
|
||||
|
||||
chown synchro "$TO_BCKP"
|
||||
|
||||
if [ "$UID" = "0" ]
|
||||
then
|
||||
SCRIPT=`pwd`/`basename "$0"`
|
||||
su -c "sh $SCRIPT $@" synchro
|
||||
exit $?
|
||||
fi
|
||||
|
||||
if mount | grep "$TO_BCKP" > /dev/null
|
||||
then
|
||||
|
||||
mysqldump -u backup --password="Riuy6of sae^W0Sh" fic2014 > "$TO_BCKP"/db-`date +%Y%m%d-%H%M`.sql
|
||||
|
||||
rsync -avL true_files/ "$TO_BCKP"
|
||||
rsync -avL logs/ "$TO_BCKP"
|
||||
rsync -avL misc/ "$TO_BCKP"
|
||||
rsync -avL .git "$TO_BCKP"
|
||||
|
||||
else
|
||||
echo No volume mount on $TO_BCKP
|
||||
fi
|
Loading…
Reference in New Issue
Block a user