
# Connect to IDRAC

# Check if power is on

    # chassis power status | grep fourth element
    # "Chassis Power is off"

    # if turn on power

        # Send Power on (ipmitool chassis power on)

    # else systemPower is on, continue. 
    

# Store current date as PWR_DATE to later compare in while loop

# Send ping to HOST every 15 seconds for 10 minutes. It can take some time for the server to start

# while PWR_DATE is less than 15 minutes compared to CURRENT_DATE, ping
    # if ping successfull 3 times in a row
        # break

# else, exit with error, 
    # exit "Host didn't start after 20 minutes. Check the server"




# SSH to HOST 

# check when verification was last ran
    # if not in the last LAST_VERIF_D, run verification
        # Verify datastore backups

    # else, backups already verified enough, continue
        # continue

# check if remote exists
# proxmox-backup-manager remote list
# ┌──────┬──────────────┬──────────┬───────────────────────────────────────────┬─────────┐
# │ name │ host         │ userid   │ fingerprint                               │ comment │
# ╞══════╪══════════════╪══════════╪═══════════════════════════════════════════╪═════════╡
# │ pbs2 │ pbs2.example │ sync@pam │64:d3:ff:3a:50:38:53:5a:9b:f7:50:...:ab:fe │         │
# └──────┴──────────────┴──────────┴───────────────────────────────────────────┴─────────┘

# for each remote host in REMOTE_PBS

    # if remote host not in "host"  collumn from "remote list" command

        # exit with "Please first add a remote to PBS"

# else 
    # print All passed remotes found on PBS


# Get local and remote stores


# Create backup one-shot sync job

# for syncJob in jobList

    # if AUTO_ADD_NAME in comment collumn of syncJob
        # remove sync-job by id

    # elif
        # Add sync job

    # else
        # idk

# run one-shop sync jobs

# for syncJob in jobList
    # if AUTO_ADD_NAME in syncJob.comment 
        # run sync-job

        # if run succesfull
            # continue
        # else
            # print the error message to stderr
        
    # elif AUTO_ADD_NAME not in syncJob.comment 
        # skipping a manually addad syncJob
    # else
        #  either no syncJobs or something broke

# store current date as PWR_OFF_DATE

# while ongoing syncJobs or ongoing verifyJobs
    # if any remaining syncJobs and verifyJobs and garbageCollect finish

        # if PWR_OFF_DATE is longer than 3 hours
            # brake in order to send shutdown signal nontheless
        # else
            # sleep for 30 seconds

# send power off signal via SSH
# if chassis power status is on after 5 minutes
    # send additional "chassis power off" via ipmitool
# else
    # exit 0



# proxmox-backup-manager sync-job create pbs2-local --remote pbs2 --remote-store local --store local --schedule 'Wed 02:30'
# proxmox-backup-manager sync-job update pbs2-local --comment 'offsite'
# proxmox-backup-manager sync-job list
# ┌────────────┬───────┬────────┬──────────────┬───────────┬─────────┐
# │ id         │ store │ remote │ remote-store │ schedule  │ comment │
# ╞════════════╪═══════╪════════╪══════════════╪═══════════╪═════════╡
# │ pbs2-local │ local │ pbs2   │ local        │ Wed 02:30 │ offsite │
# └────────────┴───────┴────────┴──────────────┴───────────┴─────────┘
# proxmox-backup-manager sync-job remove pbs2-local
