mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-30 17:30:24 +01:00
Add one sec for creating snaps in batch mode
This commit is contained in:
@@ -58,6 +58,7 @@ SNAP_CREATE=
|
||||
SNAP_ROLLBACK=
|
||||
SNAP_DESTROY=
|
||||
SNAP_VERBOSE=
|
||||
SNAP_BATCH=
|
||||
|
||||
zfs_jail_dataset() {
|
||||
|
||||
@@ -206,6 +207,10 @@ fi
|
||||
TARGET="${1}"
|
||||
ACTION="${2}"
|
||||
|
||||
if [ "${TARGET}" = "ALL" -o "${TARGET}" = "all" ]; then
|
||||
SNAP_BATCH="1"
|
||||
fi
|
||||
|
||||
bastille_root_check
|
||||
set_target "${TARGET}"
|
||||
|
||||
@@ -247,10 +252,12 @@ snapshot_checks() {
|
||||
|
||||
# Generate a relatively short but unique name for the snapshots based on the current date/jail name.
|
||||
if [ -n "${SNAP_NAME_GEN}" ]; then
|
||||
DATE=$(date +%F-%H%M%S)
|
||||
NAME_MD5X6=$(echo "${DATE} ${TARGET}" | md5 | cut -b -6)
|
||||
SNAPSHOT_NAME="Bastille_${NAME_MD5X6}_${TARGET}_${DATE}"
|
||||
TAG="${SNAPSHOT_NAME}"
|
||||
for _JAIL in ${_jail}; do
|
||||
DATE=$(date +%F-%H%M%S)
|
||||
NAME_MD5X6=$(echo "${DATE} ${TARGET}" | md5 | cut -b -6)
|
||||
SNAPSHOT_NAME="Bastille_${NAME_MD5X6}_${_JAIL}_${DATE}"
|
||||
TAG="${SNAPSHOT_NAME}"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -277,6 +284,11 @@ snapshot_create() {
|
||||
if [ "${AUTO}" -eq 1 ]; then
|
||||
bastille start "${_jail}"
|
||||
fi
|
||||
|
||||
# Delay a sec for batch snapshot creation safety.
|
||||
if [ -n "${SNAP_BATCH}" ]; then
|
||||
sleep 1
|
||||
fi
|
||||
}
|
||||
|
||||
snapshot_rollback() {
|
||||
|
||||
Reference in New Issue
Block a user