backup

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package backup creates and uploads Plex Media Server backups to S3. Plex will be stopped before the backup begins, and started again after it finishes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run added in v1.2.0

func Run(ctx context.Context, logger *slog.Logger, client *s3.Client, o *Opts) error

Run stops Plex, performs the backup, then starts Plex again. It should ideally be run soon after the server maintenance period.

Types

type Opts

type Opts struct {

	// NoPause performs the backup without stopping Plex. The server will remain
	// available throughout, but the backup may be unusable. It is specified
	// negatively in order to default to false, which is the recommended
	// setting.
	NoPause bool

	// Service is the name of Plex's systemd unit, e.g. plexmediaserver.service,
	// which will be stopped while the backup is performed, and started again
	// after it completes.
	Service string

	// Directory is the path to the 'Plex Media Server' directory, which will
	// form the root directory of the produced backup.
	Directory string

	// Bucket is the name of the S3 bucket to upload the backup to.
	Bucket string

	// Prefix is prepended to "<RFC3339 date>.tar.zst" to form the path of the
	// backup object, e.g. "2019-01-06T22:38:21Z.tar.zst". N.B. no slash is
	// automatically added to the end of the prefix. This is also the prefix
	// under which we query for old backups - if it changes, unless the new
	// value is a prefix of the old one, the previous backup will not be
	// discovered and deleted by this tool.
	Prefix string
}

Opts encapsulates parameters for backing up Plex's database.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL