miyagi-backup.sh aktualisiert
fix piggyback_data
This commit is contained in:
+20
-11
@@ -40,10 +40,10 @@ fi
|
|||||||
|
|
||||||
# Funktionen
|
# Funktionen
|
||||||
set_wol_g_enabled() {
|
set_wol_g_enabled() {
|
||||||
log "Prüfe, ob ethtool installiert ist..."
|
log "Pruefe, ob ethtool installiert ist..."
|
||||||
|
|
||||||
if ! command -v ethtool >/dev/null 2>&1; then
|
if ! command -v ethtool >/dev/null 2>&1; then
|
||||||
log "ethtool ist nicht installiert – versuche Installation..."
|
log "ethtool ist nicht installiert, versuche Installation..."
|
||||||
apt update && apt install -y ethtool || {
|
apt update && apt install -y ethtool || {
|
||||||
log "Fehler: ethtool konnte nicht installiert werden."
|
log "Fehler: ethtool konnte nicht installiert werden."
|
||||||
return 1
|
return 1
|
||||||
@@ -128,12 +128,23 @@ run_remote_updates() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
send_piggyback_data() {
|
send_piggyback_data() {
|
||||||
local fname="90000_miyagi-$SOURCEHOSTNAME-$(hostname)"
|
local combined_host="miyagi-${SOURCEHOSTNAME}-$(hostname)"
|
||||||
log "Sending piggyback data to $SOURCEHOST..."
|
local filename="90000_${combined_host}"
|
||||||
echo "<<<<miyagi-$SOURCEHOSTNAME-$(hostname)>>>" > "$fname"
|
|
||||||
/usr/bin/check_mk_agent >> "$fname"
|
log "Don’t forget to add a Host in CMK named: ${combined_host} (without Agent, Piggyback enabled)!"
|
||||||
echo "<<<<>>>>" >> "$fname"
|
log "Creating piggyback file: $filename"
|
||||||
scp "$fname" "$SOURCEHOST:/var/lib/check_mk_agent/spool/"
|
|
||||||
|
{
|
||||||
|
echo "<<<<${combined_host}>>>>"
|
||||||
|
/usr/bin/check_mk_agent
|
||||||
|
echo "<<<<>>>>"
|
||||||
|
} > "$filename"
|
||||||
|
|
||||||
|
if scp "$filename" "$SOURCEHOST:/var/lib/check_mk_agent/spool/"; then
|
||||||
|
log "Piggyback data successfully sent to $SOURCEHOST"
|
||||||
|
else
|
||||||
|
log "ERROR: Failed to send piggyback data to $SOURCEHOST"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
run_pbs_backup() {
|
run_pbs_backup() {
|
||||||
@@ -267,7 +278,5 @@ elif [[ "${1:-}" =~ ^[a-zA-Z0-9_]+$ && "$(type -t "$1")" == "function" ]]; then
|
|||||||
"$FUNC" "$@"
|
"$FUNC" "$@"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "Sleeping for another 60 seconds before starting main routine..."
|
|
||||||
sleep 60
|
|
||||||
main
|
main
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user