script "host-backup" --> added a other version with git and rsync below #1738

Closed
opened 2026-02-05 02:06:26 +03:00 by OVERLORD · 5 comments
Owner

Originally created by @089a on GitHub (Oct 7, 2025).

Have you read and understood the above guidelines?

yes

📜 What is the name of the script you are using?

https://community-scripts.github.io/ProxmoxVE/scripts?id=host-backup

📂 What was the exact command used to execute the script?

bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/host-backup.sh)"

⚙️ What settings are you using?

  • Default Settings
  • Advanced Settings

🖥️ Which Linux distribution are you using?

Debian 13

📈 Which Proxmox version are you on?

9.0

📝 Provide a clear and concise description of the issue.

The script seems to be a grapical addon for "cp" comand?
My expetion was a real backup script to rebuild a proxmox server from a fresh installed machine to a running machine without the vm/ct volumes but with configured ct/vm.

Features that i will need are:

  • Make Backup to folders -> gitea server
  • Monitore the backup process and the consistency of the backup

🔄 Steps to reproduce the issue.

Execute the Script

Paste the full error output (if available).

No Errormessages visible

🖼️ Additional context (optional).

No response

Originally created by @089a on GitHub (Oct 7, 2025). ### ✅ Have you read and understood the above guidelines? yes ### 📜 What is the name of the script you are using? https://community-scripts.github.io/ProxmoxVE/scripts?id=host-backup ### 📂 What was the exact command used to execute the script? bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/host-backup.sh)" ### ⚙️ What settings are you using? - [x] Default Settings - [ ] Advanced Settings ### 🖥️ Which Linux distribution are you using? Debian 13 ### 📈 Which Proxmox version are you on? 9.0 ### 📝 Provide a clear and concise description of the issue. The script seems to be a grapical addon for "cp" comand? My expetion was a real backup script to rebuild a proxmox server from a fresh installed machine to a running machine without the vm/ct volumes but with configured ct/vm. Features that i will need are: - Make Backup to folders -> gitea server - Monitore the backup process and the consistency of the backup ### 🔄 Steps to reproduce the issue. Execute the Script ### ❌ Paste the full error output (if available). No Errormessages visible ### 🖼️ Additional context (optional). _No response_
OVERLORD added the bug label 2026-02-05 02:06:26 +03:00
Author
Owner

@089a commented on GitHub (Oct 7, 2025):

i also found this https://forum.proxmox.com/threads/how-to-backup-proxmox-configuration-files.67789/
... they explain that it is recommended to backup the /etc/pve /etc/network/interfaces /etc/passwd and /etc/resolv.conf.
... /etc/passwd you should probably also backup /etc/shadow, /etc/group

@089a commented on GitHub (Oct 7, 2025): i also found this https://forum.proxmox.com/threads/how-to-backup-proxmox-configuration-files.67789/ ... they explain that it is recommended to backup the /etc/pve /etc/network/interfaces /etc/passwd and /etc/resolv.conf. ... /etc/passwd you should probably also backup /etc/shadow, /etc/group
Author
Owner

@tremor021 commented on GitHub (Oct 7, 2025):

Have you even used the script before? By using i mean to backup the configuration you can later use to restore the host?

@tremor021 commented on GitHub (Oct 7, 2025): Have you even used the script before? By using i mean to backup the configuration you can later use to restore the host?
Author
Owner

@michelroegl-brunner commented on GitHub (Oct 7, 2025):

Features that i will need are:

Make Backup to folders -> gitea server
Monitore the backup process and the consistency of the backup

I know, this might possibly result in a angry redit post again, but mate....

Why are you demanding stuff in a way as if we are oblidge to build stuff you want. If you want some feature you may ask nicely if this could be done. We are doing that on our spare time, and we will prioritize what we do, when we do it and how we do it.

If you want a feature and it is not here, either build it yourself or at least ask politly if anyone is willing to spend unpaid freetime to accomodate your wishes....

Also, only run scripts you have read and understood...

@michelroegl-brunner commented on GitHub (Oct 7, 2025): ``` Features that i will need are: Make Backup to folders -> gitea server Monitore the backup process and the consistency of the backup ``` I know, this might possibly result in a angry redit post again, but mate.... Why are you demanding stuff in a way as if we are oblidge to build stuff you want. If you want some feature you may ask nicely if this could be done. We are doing that on our spare time, and we will prioritize what we do, when we do it and how we do it. If you want a feature and it is not here, either build it yourself or at least ask politly if anyone is willing to spend unpaid freetime to accomodate your wishes.... Also, only run scripts you have read and understood...
Author
Owner

@089a commented on GitHub (Oct 7, 2025):

No, but verified it. There is no option for git...

i'll create my own script :
rsync -azv --no-links --include-from=/opt/BU_PVE1/_liste.txt --exclude='*' / /opt/BU_PVE1/

_liste.txt
/etc/***
/var/lib/pve-cluster/***
/root/***
/var/spool/cron/***
/usr/share/kvm/.vbios
/opt/community-scripts
**

@089a commented on GitHub (Oct 7, 2025): No, but verified it. There is no option for git... i'll create my own script : rsync -azv --no-links --include-from=/opt/BU_PVE1/_liste.txt --exclude='*' / /opt/BU_PVE1/ _liste.txt /etc/*** /var/lib/pve-cluster/*** /root/*** /var/spool/cron/*** /usr/share/kvm/*.vbios /opt/community-scripts***
Author
Owner

@089a commented on GitHub (Oct 8, 2025):

Here is my script for doing that with git and rsync:

#!/bin/bash
--
# Description: Proxmox config to git
clear
SCRIPTNAME=$(basename "$0")
DATE=$(date "+%Y%m%d_%H%M%S")
WHOAMI=$(whoami)
REM="10.0.0.10" # remote IP/HOST  for rsync
RSYNC="/usr/bin/rsync -azvR"
GIT="/usr/bin/git"
DST0="/opt/pvebackup"
DST="/opt/pvebackup/${HOSTNAME}"
PID_FILE="/var/run/${SCRIPTNAME}.pid"
# --- Root Check ---
if [ "$WHOAMI" != "root" ]; then
logger -p local5.debug "${SCRIPTNAME} must run as root and not as ${WHOAMI} $(date "+%Y%m%d_%H%M%S")"
echo "${SCRIPTNAME} script must run as root ${WHOAMI}"
exit 1
fi
 
if [ ! -d "$DST0" ]; then
#    mkdir -p ${DST0}
#    echo ">>>>> directory created ${DST}<<<<<<"
${GIT} clone gitea@gitea:UBH/pve.git ${DST0}
echo ${GIT} clone gitea@gitea:UBH/pve.git ${DST0}
fi
 
if [ -f "$PID_FILE" ]; then
logger -p local5.debug "${SCRIPTNAME} already running at $(date "+%Y%m%d_%H%M%S") check ${PID_FILE}"
echo "${SCRIPTNAME} still running --> rm ${PID_FILE}"
exit 1
else
logger -p local5.debug "${SCRIPTNAME} START at $(date "+%Y%m%d_%H%M%S")"
# $$ ist die Prozess-ID der aktuellen Shell, funktioniert in Bash genauso
echo $$ > "$PID_FILE"
echo ">>>>>Processing ${SCRIPTNAME}<<<<<<"
fi
######################################  COMMAND  ######################################
#echo ">>>>> Job0 <<<<<"
#${RSYNC} -n -azv --files-from=/root/include.txt / root@"${REM}":/
# echo ">>>>> Job1 <<<<<"
#${RSYNC} -n -azvr /usr/home root@"${REM}":/usr/
echo ">>>>>${RSYNC} /etc ${DST}"
${RSYNC} /etc ${DST}
echo ">>>>>${RSYNC} /var/lib/pve-cluster ${DST}"
${RSYNC} /var/lib/pve-cluster ${DST}
echo ">>>>>${RSYNC} /root ${DST}"
${RSYNC} /root ${DST}
echo ">>>>>${RSYNC} /var/spool/cron ${DST}"
${RSYNC} /var/spool/cron ${DST}
echo ">>>>>${RSYNC} /opt/community-scripts ${DST}"
${RSYNC} /opt/community-scripts ${DST}
######################################  COMMAND  ######################################
# --- Cleanup ---
logger -p local5.debug "${SCRIPTNAME} END $(date "+%Y%m%d_%H%M%S")"
rm "$PID_FILE"
 
cd ${DST}
${GIT} add --all
${GIT} commit -a -m "$(hostname) \| $(date '+%Y-%m-%d %H:%M:%S') \| $(whoami) \| autocommit by script"
${GIT} push gitea@gitea:UBH/pve.git
# create / add ssh key to gitea server
@089a commented on GitHub (Oct 8, 2025): Here is my script for doing that with git and rsync: ``` #!/bin/bash -- # Description: Proxmox config to git clear SCRIPTNAME=$(basename "$0") DATE=$(date "+%Y%m%d_%H%M%S") WHOAMI=$(whoami) REM="10.0.0.10" # remote IP/HOST for rsync RSYNC="/usr/bin/rsync -azvR" GIT="/usr/bin/git" DST0="/opt/pvebackup" DST="/opt/pvebackup/${HOSTNAME}" PID_FILE="/var/run/${SCRIPTNAME}.pid" # --- Root Check --- if [ "$WHOAMI" != "root" ]; then logger -p local5.debug "${SCRIPTNAME} must run as root and not as ${WHOAMI} $(date "+%Y%m%d_%H%M%S")" echo "${SCRIPTNAME} script must run as root ${WHOAMI}" exit 1 fi   if [ ! -d "$DST0" ]; then # mkdir -p ${DST0} # echo ">>>>> directory created ${DST}<<<<<<" ${GIT} clone gitea@gitea:UBH/pve.git ${DST0} echo ${GIT} clone gitea@gitea:UBH/pve.git ${DST0} fi   if [ -f "$PID_FILE" ]; then logger -p local5.debug "${SCRIPTNAME} already running at $(date "+%Y%m%d_%H%M%S") check ${PID_FILE}" echo "${SCRIPTNAME} still running --> rm ${PID_FILE}" exit 1 else logger -p local5.debug "${SCRIPTNAME} START at $(date "+%Y%m%d_%H%M%S")" # $$ ist die Prozess-ID der aktuellen Shell, funktioniert in Bash genauso echo $$ > "$PID_FILE" echo ">>>>>Processing ${SCRIPTNAME}<<<<<<" fi ###################################### COMMAND ###################################### #echo ">>>>> Job0 <<<<<" #${RSYNC} -n -azv --files-from=/root/include.txt / root@"${REM}":/ # echo ">>>>> Job1 <<<<<" #${RSYNC} -n -azvr /usr/home root@"${REM}":/usr/ echo ">>>>>${RSYNC} /etc ${DST}" ${RSYNC} /etc ${DST} echo ">>>>>${RSYNC} /var/lib/pve-cluster ${DST}" ${RSYNC} /var/lib/pve-cluster ${DST} echo ">>>>>${RSYNC} /root ${DST}" ${RSYNC} /root ${DST} echo ">>>>>${RSYNC} /var/spool/cron ${DST}" ${RSYNC} /var/spool/cron ${DST} echo ">>>>>${RSYNC} /opt/community-scripts ${DST}" ${RSYNC} /opt/community-scripts ${DST} ###################################### COMMAND ###################################### # --- Cleanup --- logger -p local5.debug "${SCRIPTNAME} END $(date "+%Y%m%d_%H%M%S")" rm "$PID_FILE"   cd ${DST} ${GIT} add --all ${GIT} commit -a -m "$(hostname) \| $(date '+%Y-%m-%d %H:%M:%S') \| $(whoami) \| autocommit by script" ${GIT} push gitea@gitea:UBH/pve.git # create / add ssh key to gitea server ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ProxmoxVE#1738