Files
PBSupper/README.md

3.7 KiB
Raw Permalink Blame History

PBSupper

Description

This program/container automatically powers on a remote server via 623/UDP to iDRAC, and likely other BMCs, connects to Proxmox Backup Server via SSH, so 22/TCP but this can be customized, creates and runs a sync-job, then shuts down PBS.

Why?

I wanted to automate waking up my server, running a sync-job and shuting down said server. iDRAC6/7 doesn't have that option so I've built one.

Configurations

Here is a description of the most necessary and all the other environment variables

Necessary envs

BMC envs

  • IDRAC -- IP address of the remote BMC (Default: None)
  • IDRAC_USR -- Username of the remote BMC. This user needs to have permission to power on/off the server as well as check the power status (Default: None)
  • IDRAC_PWD -- Password of the IDRAC_USR user (Default: None)

Remote Server envs

  • HOST -- IP address, or FQDN, of Proxmox Backup Server. It needs to listen for SSH connections (Default: None)
  • HOST_USR -- Username of the user on Proxmox Backup Server (Default: root)
  • HOST_USR_PWD -- Password for the username specified in HOST_USR (Default: None)

If you want to use SSH-keys, use the following environment variables and leave HOST_USR_PWD empty

  • HOST_USR_SSHKEY -- Private ssh-key that will be user to connect to PBS. Leave empty if using username+password (Default: None)
  • HOST_USR_SSHKEY_PASS -- Passphrase for the ssh-key. Leave empty if key is passwordless (Default: None)

PBS envs

  • LOCAL_DATASTORE -- Name of the datastore on the PBS that is passed in HOST variable (Default: None)
  • REMOTE_DATASTORE -- Name of the datastore that the local datastore will sync to/from (Default: None)
  • REMOTE_PBS -- IP address, or FQDN, of the remote PBS that the local PBS will sync to/from (Default: None)

Container-specific envs

  • RUN_SCHEDULE -- At what time should the server be woken up. Written in Cron notation (Default: "45 17 * * 5")
  • RUN_SCHEDULE_TZ -- Timezone in which container is. Set to your local timezone as otherwise the wake-up time might be inaccurate. (Default: "Europe/Stockholm")

Other environment variables

Here are the other environment variables that can be set

  • HOST_SSH_PORT -- SSH port at which PBS is listening on (Default: 22)

  • SYNC_DIR -- Direction of the sync-job. (Default: push)

  • PBS_RATE_OUT -- Speed at which sync is sent. Reffer to PBS documentation (Default: None)

  • PBS_RATE_IN -- Speed at which sync is received. Reffer to PBS documentation (Default: None)

  • PBS_TASK_LIMIT -- How many tasks should be analyzed. Best to leave it at default (Default: 50)

  • PBS_MAX_RUNTIME_MIN -- Max time which PBS might run after the sync-job. Usually it is caused by Verification jobs or Garbage collection jobs. If a aptupdate, reader or other tasks are running, then MAX_RUNTIME might be longer as these tasks are critical. (Default: 180)

  • PBS_MAX_SHUT_MIN -- Max time which PBS has for a safe shutdown. This variable is used after a shutdown command is sent to PBS server. (Default: 10)

  • AUTO_ADD_NAME -- This is a name that is set as sync-job id. (Default: "autoBackupScript_one-shot")

  • RUN_ONE_SHOT -- If the script should only be ran once. Do not set/use unless you have specific usecase. (Default: False)

Yeeee