Jump to content

Peterca

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by Peterca

  1. Hi guys,

    I use UserScripts to prepare/back up appdata (Dockers) and domains (VMs) and then i use Duplicacy to make backups. In Duplicacy i can then restore different versions from a dropdown. This way i can restore specific docker/VM back to Unraid. 

    I'm an newbie at Unraid, rsync and tar so maybe this it totally wrong but it works for me.

    Please tell me if you have some idea's on how to improve (or maybe tell me to scrap it all 😄)

     

     

    DOCKERS
     

    #!/bin/bash
    
    # Get all running containers and store them in $CONTAINERS
    mapfile -t CONTAINERS < <( docker inspect --format='{{.Name}}' $(docker ps -q --no-trunc) | cut -c2- )
    
    # show in logrun
    echo "Appdata backup started - Starting to shut down dockers"
    
    # Show notification in Unraid (alert, warning, normal)
    /usr/local/emhttp/webGui/scripts/notify -s "Notice [Script] -Appdata backup started" -i "normal" -d "Starting to shut down dockers"
    
    # Stop all running containers
    for container in "${CONTAINERS[@]}"; do
      echo "Stopping ${container}..."
      docker stop ${container} 1> /dev/null
    done
    
    # show in logrun
    echo "Dockers shutted down. Starting backup"
    
    # Show notification in Unraid (alert, warning, normal)
    /usr/local/emhttp/webGui/scripts/notify -s "Warning [Script] -Appdata backup running" -i "warning" -d "Dockers shutted down. Starting backup"
    
    # Backup appdata
    echo "Backing up /mnt/user/appdata/"
    rsync -a --delete /mnt/user/appdata/ /mnt/user/backups/appdatabackups/
    
    # Show notification in Unraid (alert, warning, normal)
    /usr/local/emhttp/webGui/scripts/notify -s "Warning [Script] -Appdata backup running" -i "warning" -d "Backup done. Starting dockers"
    
    # Start all containers that were previously running
    for container in "${CONTAINERS[@]}"; do
      echo "Starting ${container}..."
      docker start ${container} 1> /dev/null
    done
    
    # show in logrun
    echo "Dockers started. Starting to tar files"
    
    # Show notification in Unraid (alert, warning, normal)
    /usr/local/emhttp/webGui/scripts/notify -s "Warning [Script] -Appdata backup running" -i "warning" -d "Dockers started. Starting to tar files"
    
    # Compress appdata and remove original folders
    find /mnt/user/backups/appdatabackups/ -type d -maxdepth 1 -mindepth 1 -exec tar zcvf {}.tar.gz {} --remove-files \;
    
    # show in logrun
    echo "Appdata backup done - Ready to do Duplicacy backup"
    
    # Show notification in Unraid (alert, warning, normal)
    /usr/local/emhttp/webGui/scripts/notify -s "Notice [Script] - Appdata backup done" -i "normal" -d "Ready to do Duplicacy backup"



    VMs

     

    #!/bin/bash
    
    #Empty vm list
    echo "" > /tmp/vms-running.txt
    
    # show in logrun
    echo "VMs backup started - Starting to shut down VMs"
    
    # Show notification in Unraid (alert, warning, normal)
    /usr/local/emhttp/webGui/scripts/notify -s "Notice [Script] -VMs backup started" -i "normal" -d "Starting to shut down VMs"
    
    #Get all running vms except VM-TO-NOT-SHUTDOWN server
    for VM in $(virsh list --state-running --name); do
      if [[ ! "$VM" == "VM-TO-NOT-SHUTDOWN" ]] ; then
        virsh shutdown "$VM"
    
    #Write running vms to list
    echo "$VM" >> /tmp/vms-running.txt
    
    fi
    done
    
    # sleep if no vm is started to get next notice
    sleep 5
    
    # show in logrun
    echo "VMs shutted down. Starting backup"
    
    # Show notification in Unraid (alert, warning, normal)
    /usr/local/emhttp/webGui/scripts/notify -s "Warning [Script] -VMs backup running" -i "warning" -d "VMs shutted down. Starting backup"
    
    # Backup appdata
    echo "Backing up /mnt/user/domains/"
    rsync -a --delete /mnt/user/domains/ /mnt/user/backups/vmbackups/
    
    # Show notification in Unraid (alert, warning, normal)
    /usr/local/emhttp/webGui/scripts/notify -s "Warning [Script] -VMs backup running" -i "warning" -d "Backup done. Starting VMs"
    
    #Get all running vms except backup server
    for VM in $(cat /tmp/vms-running.txt); do
      virsh start "$VM"
    
    done
    
    # show in logrun
    echo "VMs started. Starting to tar files"
    
    # Show notification in Unraid (alert, warning, normal)
    /usr/local/emhttp/webGui/scripts/notify -s "Warning [Script] -VMs backup running" -i "warning" -d "VMs started. Starting to tar files"
    
    # Compress appdata and remove original folders
    find /mnt/user/backups/vmbackups/ -type d -maxdepth 1 -mindepth 1 -exec tar zcvf {}.tar.gz {} --remove-files \;
    
    # show in logrun
    echo "VMs backup done - Ready to do Duplicacy backup"
    
    # Show notification in Unraid (alert, warning, normal)
    /usr/local/emhttp/webGui/scripts/notify -s "Notice [Script] - VMs backup done" -i "normal" -d "Ready to do Duplicacy backup"

     

  2. Hi guys,

    Maybe a stupid question but the field in the GUI called: Backup path i notices that in binhex it said /media and in the official one i said /backups

     

    My questions:
    1 do i leave it at /backups or do i need to put some values here like /mnt/user/appdata/influxdb as im only looking to back up my InfluxDB?
    2 i want this backup to be stored in the cloud if my server crashes. Is this possible or do i have to buy the InfluxDB Cloud service?

    Have a nice day


     

  3. Hi guys,

     

    Can anyone please help me determine if my server is powerful enough for some serious gaming?

    Motherboard:

    Micro-Star International Co., Ltd. B550-A PRO (MS-7C56) , Version 1.0
    American Megatrends International, LLC., Version A.50

    Processor:
    AMD Ryzen 7 5800X 8-Core @ 3800 MHz

     

    RAM:

    64 GIB DDR4

     

    Cache pool:
    2 x Samsung_SSD_980_PRO_with_Heatsink_1TB

    Graphic:
    Just som crap to get picture. Here is were i probably need some help with what graphic card i should buy.

    I would really appreciate som input in wether my server is capable to run som cool games.

    Have a nice day.

  4. Hi guys,

     

    I'm sorry but i have to ask a question that might be stupid.

     

    I have a few VM's that i have pinned some RAM for but i just want to clearify that this RAM is not "locked" when the VM is not running?

     

    Have a nice day.

  5. Please forgive me for asking stupid questions.

     

    I successfully installed Netdata (Docker) and i looks like all values are the same as unraid but i have to look in separate browserwindow. How does this work in this project?

     

    I would like all stuff in my unraid, is this possible?


    Best regards
    /Peter Carlsson

×
×
  • Create New...