2 Commits

Author SHA1 Message Date
b15af7f22f Change description 2015-12-06 17:27:09 +01:00
4623d023b9 Fix minor issue
Now ownership of the log files is set to the user specified by the
-u option if that option is used
2015-12-06 17:16:31 +01:00

View File

@ -15,12 +15,11 @@
#You should have received a copy of the GNU General Public License #You should have received a copy of the GNU General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#Version 1.2.2
#Simple backup script. Reads options, sources and destination from a configuration file or standard input #Simple backup script. Reads options, sources and destination from a configuration file or standard input
#Help function #Help function
function help_function { function help_function {
echo "simple_backup, version 1.0.0" echo "simple_backup, version 1.2.3"
echo "" echo ""
echo "Usage: $0 [OPTIONS]" echo "Usage: $0 [OPTIONS]"
echo "" echo ""
@ -287,6 +286,7 @@ function parse_options {
HOMEDIR="/home/$2" HOMEDIR="/home/$2"
config="/home/$2/.simple_backup/config" config="/home/$2/.simple_backup/config"
USER="$2"
read_conf "$config" read_conf "$config"
@ -398,6 +398,14 @@ else
error_flag=0 error_flag=0
fi fi
#Fix ownership and permissions of log files if needed
if [[ ! -z $USER ]]; then
chown $USER:$USER $LOG && chmod 644 $LOG
chown $USER:$USER $ERR && chmod 644 $ERR
chown $USER:$USER $WARN && chmod 644 $WARN
fi
#Copy log files in home directory
mv $LOG "$HOMEDIR/.simple_backup/simple_backup.log" mv $LOG "$HOMEDIR/.simple_backup/simple_backup.log"
mv $ERR "$HOMEDIR/.simple_backup/errors.log" mv $ERR "$HOMEDIR/.simple_backup/errors.log"
mv $WARN "$HOMEDIR/.simple_backup/warnings.log" mv $WARN "$HOMEDIR/.simple_backup/warnings.log"