52 lines
1.2 KiB
Bash
Executable File
52 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Copyright (C) 2019 Carlos Galindo
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
confDir=/etc/backbit
|
|
|
|
if [ ! -z $1 -a -d $1 ]
|
|
then
|
|
confDir=$1
|
|
fi
|
|
|
|
logDir=/var/log/backbit
|
|
|
|
if [ ! -d $logDir ]
|
|
then
|
|
mkdir -p $logDir
|
|
chmod 755 $logDir
|
|
fi
|
|
|
|
if [ -x $confDir/before.sh ]
|
|
then
|
|
. $confDir/before.sh | tee -a $logDir/before.log
|
|
fi
|
|
|
|
for conf in $(ls $confDir/db/*)
|
|
do
|
|
$(which backbitdb) $conf | tee -a $logDir/$(basename $conf).log
|
|
done
|
|
|
|
for conf in $(ls $confDir/dir/*)
|
|
do
|
|
$(which backbitdir) $conf | tee -a $logDir/$(basename $conf).log
|
|
done
|
|
|
|
if [ -x $confDir/after.sh ]
|
|
then
|
|
. $confDir/after.sh | tee -a $logDir/after.log
|
|
fi
|