diff --git a/usr/local/share/bastille/migrate.sh b/usr/local/share/bastille/migrate.sh index 8f492021..fb23b54c 100644 --- a/usr/local/share/bastille/migrate.sh +++ b/usr/local/share/bastille/migrate.sh @@ -295,14 +295,17 @@ migrate_jail() { # Destroy old jail if OPT_DESTROY=1 if [ "${OPT_DESTROY}" -eq 1 ]; then - bastille destroy -af "${_jail}" + bastille destroy -afy "${_jail}" fi # Remove archives migrate_cleanup "${_jail}" "${_user}" "${_host}" "${_port}" - # Start new jail if AUTO=1 - if [ "${AUTO}" -eq 1 ]; then + # Reconcile LIVE and AUTO, ensure only one side is running + if [ "${AUTO}" -eq 1 ] && [ "${LIVE}" -eq 0 ]; then + ${_sshpass_cmd} ssh -p ${_port} ${_opt_ssh_key} ${_user}@${_host} ${OPT_SU} bastille start "${_jail}" + elif [ "${AUTO}" -eq 1 ] && [ "${LIVE}" -eq 1 ]; then + bastille stop "${_jail}" ${_sshpass_cmd} ssh -p ${_port} ${_opt_ssh_key} ${_user}@${_host} ${OPT_SU} bastille start "${_jail}" fi }