Dateien nach "/" hochladen
fix pbs_storage
This commit is contained in:
+26
-6
@@ -28,6 +28,8 @@ while getopts "c:" opt; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Bei Einzelaufruf muss Konfiguration geladen sein
|
# Bei Einzelaufruf muss Konfiguration geladen sein
|
||||||
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
if [[ -n "${CONFIG_FILE:-}" ]]; then
|
if [[ -n "${CONFIG_FILE:-}" ]]; then
|
||||||
if [[ ! -f "$CONFIG_FILE" ]]; then
|
if [[ ! -f "$CONFIG_FILE" ]]; then
|
||||||
log "ERROR: Configuration file not found: $CONFIG_FILE"
|
log "ERROR: Configuration file not found: $CONFIG_FILE"
|
||||||
@@ -93,7 +95,22 @@ send_piggyback_data() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run_pbs_backup() {
|
run_pbs_backup() {
|
||||||
|
if [[ -z "${SOURCEHOSTNAME:-}" ]]; then
|
||||||
|
SOURCEHOSTNAME=$(ssh "$SOURCEHOST" hostname)
|
||||||
|
fi
|
||||||
|
|
||||||
log "Running PBS vzdump job..."
|
log "Running PBS vzdump job..."
|
||||||
|
|
||||||
|
# Storage aktivieren, falls deaktiviert
|
||||||
|
log "Checking if PBS storage '$BACKUPSTORE' is enabled on $SOURCEHOST..."
|
||||||
|
if ssh root@"$SOURCEHOST" "pvesm status | grep -w '$BACKUPSTORE' | grep -q 'disabled'"; then
|
||||||
|
log "PBS storage '$BACKUPSTORE' is disabled. Attempting to enable..."
|
||||||
|
ssh root@"$SOURCEHOST" "pvesm set '$BACKUPSTORE' --disable 0 && sleep 2"
|
||||||
|
else
|
||||||
|
log "PBS storage '$BACKUPSTORE' is already enabled."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Backup starten
|
||||||
ssh root@"$SOURCEHOST" vzdump --pbs-change-detection-mode metadata \
|
ssh root@"$SOURCEHOST" vzdump --pbs-change-detection-mode metadata \
|
||||||
--node "$SOURCEHOSTNAME" --storage "$BACKUPSTORE" \
|
--node "$SOURCEHOSTNAME" --storage "$BACKUPSTORE" \
|
||||||
--exclude "$BACKUPEXCLUDE" --mode snapshot --all 1 \
|
--exclude "$BACKUPEXCLUDE" --mode snapshot --all 1 \
|
||||||
@@ -123,18 +140,18 @@ run_maintenance() {
|
|||||||
|
|
||||||
run_scrub_stop_src() {
|
run_scrub_stop_src() {
|
||||||
ssh root@"$SOURCEHOST" 'for pool in $(zpool list -H -o name); do
|
ssh root@"$SOURCEHOST" 'for pool in $(zpool list -H -o name); do
|
||||||
echo "⏹️ Stoppe Scrub auf Pool: $pool"
|
echo " Stoppe Scrub auf Pool: $pool"
|
||||||
zpool scrub -s "$pool"
|
zpool scrub -s "$pool"
|
||||||
done'
|
done'
|
||||||
}
|
}
|
||||||
|
|
||||||
run_scrub_stop_local() {
|
run_scrub_stop_local() {
|
||||||
for pool in $(zpool list -H -o name); do
|
for pool in $(zpool list -H -o name); do
|
||||||
echo "⏹️ Stoppe Scrub auf Pool: $pool"
|
echo " Stoppe Scrub auf Pool: $pool"
|
||||||
if zpool scrub -s "$pool"; then
|
if zpool scrub -s "$pool"; then
|
||||||
echo "✔️ Scrub auf $pool gestoppt"
|
echo " Scrub auf $pool gestoppt"
|
||||||
else
|
else
|
||||||
echo "❌ Fehler beim Stoppen des Scrubs auf $pool"
|
echo " Fehler beim Stoppen des Scrubs auf $pool"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@@ -156,13 +173,14 @@ main() {
|
|||||||
|
|
||||||
write_zsync_config
|
write_zsync_config
|
||||||
run_zsync
|
run_zsync
|
||||||
run_updates
|
|
||||||
run_maintenance
|
run_maintenance
|
||||||
run_scrub_stop_local
|
run_scrub_stop_local
|
||||||
run_scrub_stop_src
|
run_scrub_stop_src
|
||||||
run_pbs_backup
|
run_pbs_backup
|
||||||
run_remote_updates
|
run_remote_updates
|
||||||
|
run_updates
|
||||||
shutdown_if_requested
|
shutdown_if_requested
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Funktionsbasierter Aufruf
|
# Funktionsbasierter Aufruf
|
||||||
@@ -171,8 +189,10 @@ if [[ "${1:-}" == "help" ]]; then
|
|||||||
declare -F | awk '{print " - " $3}' | grep -v "^ - _"
|
declare -F | awk '{print " - " $3}' | grep -v "^ - _"
|
||||||
exit 0
|
exit 0
|
||||||
elif [[ "${1:-}" =~ ^[a-zA-Z0-9_]+$ && "$(type -t "$1")" == "function" ]]; then
|
elif [[ "${1:-}" =~ ^[a-zA-Z0-9_]+$ && "$(type -t "$1")" == "function" ]]; then
|
||||||
|
FUNC="$1"
|
||||||
shift
|
shift
|
||||||
"$@"
|
"$FUNC" "$@"
|
||||||
|
exit 0
|
||||||
else
|
else
|
||||||
main
|
main
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user