Skip to content
This repository has been archived by the owner on Mar 7, 2022. It is now read-only.

Commit

Permalink
#12 restore files before and after configuring
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenverhoef committed Mar 19, 2020
1 parent feab529 commit 82a0018
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions freenas-jails.sh
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,21 @@ install_jail () {
rm -rf $JAIL_LOCATION/webserver/root/root/${!MYSQL_DATA}.sql
fi
fi

i=1
while true; do
FOLDER="$(sed -n ''$i'p' ${JAIL_CONFIG%/*}/backup.conf)"
DEST_FOLDER="$(sed -n ''$i'p' ${JAIL_CONFIG%/*}/backup.conf | cut -d " " -f1)"
DEST_FOLDER=${DEST_FOLDER%/*}/
(( i++ ))
if [ "$FOLDER" ]; then
USER=$(stat -f %Su $(dirname $JAIL_LOCATION/$JAIL/root$DEST_FOLDER))
GROUP=$(stat -f %Sg $(dirname $JAIL_LOCATION/$JAIL/root$DEST_FOLDER))
rsync -a $BACKUP_LOCATION/$JAIL$FOLDER $JAIL_LOCATION/$JAIL/root$DEST_FOLDER --chown=$USER:$GROUP
else
break
fi
done
fi
fi

Expand Down

0 comments on commit 82a0018

Please sign in to comment.