Sourced config.sh
This commit is contained in:
parent
de09f40deb
commit
1bbc562fce
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
*.log
|
@ -1,19 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./config.sh
|
||||||
|
|
||||||
# IO Redirection
|
# IO Redirection
|
||||||
exec > backup.log
|
exec > $LOGFILE
|
||||||
|
|
||||||
# exec 2> backup_err.log
|
exec 2> $ERRLOG
|
||||||
|
|
||||||
BMOUNT=/mnt/backup
|
if [[ -n $BMOUNT ]] && ! grep -qs $BMOUNT /proc/mounts; then
|
||||||
BAKDIR=$BMOUNT/backup/cron
|
|
||||||
|
|
||||||
if ! grep -qs $BMOUNT /proc/mounts; then
|
|
||||||
echo Mounting $BMOUNT ...
|
echo Mounting $BMOUNT ...
|
||||||
mount $BMOUNT
|
mount $BMOUNT
|
||||||
|
MOUNTED=$?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if ! [ -d $BAKDIR ]; then
|
if ! [ -d $BAKDIR ]; then
|
||||||
mkdir $BAKDIR
|
mkdir $BAKDIR
|
||||||
fi
|
fi
|
||||||
@ -86,4 +85,6 @@ while read line; do
|
|||||||
# echo --\> $line
|
# echo --\> $line
|
||||||
done < backup_list
|
done < backup_list
|
||||||
|
|
||||||
umount $BMOUNT
|
if [[ "$MOUNTED" -eq 0 ]]; then
|
||||||
|
umount $BMOUNT
|
||||||
|
fi
|
||||||
|
7
bash/cronbackup/config.sh
Normal file
7
bash/cronbackup/config.sh
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash`
|
||||||
|
|
||||||
|
LOGFILE=backup.log
|
||||||
|
ERRLOG=backup_errors.log
|
||||||
|
|
||||||
|
BMOUNT=/mnt/backup
|
||||||
|
BAKDIR=$BMOUNT/backup/cron
|
Loading…
Reference in New Issue
Block a user