Document some script + centralize script configuration

This commit is contained in:
nemunaire 2014-11-19 18:29:46 +01:00
commit 96805a5e1b
7 changed files with 48 additions and 14 deletions

View file

@ -1,21 +1,24 @@
#!/bin/sh
cd `dirname "$0"`
TO_BCKP="/mnt/backup"
# This script mades backup of important things
chown synchro "$TO_BCKP"
cd `dirname "$0"`
source config.sh
chown "$SYNCHRO_USER" "$TO_BCKP"
if [ "$UID" = "0" ]
then
SCRIPT=`pwd`/`basename "$0"`
su -c "sh $SCRIPT $@" synchro
su -c "sh $SCRIPT $@" "$SYNCHRO_USER"
exit $?
fi
if mount | grep "$TO_BCKP" > /dev/null
then
mysqldump -u backup --password="Riuy6of sae^W0Sh" fic > "$TO_BCKP"/db/`date +%Y%m%d-%H%M`.sql
mysqldump -u backup --password="$BCKP_PASS" fic > "$TO_BCKP"/db/`date +%Y%m%d-%H%M`.sql
rsync -avL misc "$TO_BCKP"
rsync -avL .git "$TO_BCKP"
@ -24,5 +27,5 @@ then
rsync -avL true_files "$TO_BCKP"
else
echo No volume mount on $TO_BCKP
echo No volume mounted on $TO_BCKP
fi