Skip to main content
Hooks let Edge run a shell command around each job in a backup cycle:
  • Pre command: before Edge scans and archives the job. Edge waits for it to finish. Useful for dumping a database into the folder first.
  • Post command: after the job is done, whether it uploaded, was unchanged, or failed. Cancellation skips the post command.
Hooks run during scheduled cycles and Run Backup Cycle Now. The individual Force Upload action currently bypasses both hooks.

Set up

1

Open Custom Scripts

In Edge, click Custom Scripts.
2

Upload a script (optional)

Under Uploaded Items, upload up to 3 files. Only .sh scripts and .txt helper files are allowed, and they must be UTF-8 text. .sh files are made executable, and Windows line endings are converted.
3

Set the commands

Enter a Pre Command and/or Post Command. Either:
  • the name of an uploaded script, such as before-backup.sh, or
  • any shell command, such as curl -fsS https://hc-ping.com/your-id.
Commands run with sh -c inside the Edge container, from the hook scripts folder (/hook-scripts). Each command has a 5-minute timeout, and is stopped if you Cancel operation. Output and non-zero exit codes go to Edge’s logs; a failing hook doesn’t stop the backup. The same commands run for every job. Use THREETOONEGO_JOB_NAME to act on specific jobs. Edge prepares different jobs concurrently, so their hooks can overlap. Keep per-job output separate when your scripts write files.

Environment variables

In the pre command these describe the job’s state from its previous run. In the post command they describe the run that just finished.

Example: report each job to a health check

after-job.sh
Common THREETOONEGO_LAST_STATUS values after a job: Set Post Command to after-job.sh.
The Edge image is a minimal Alpine image with sh and curl. Other tools, such as database clients, aren’t included. To dump a database before a backup, run the dump on the host on a schedule ahead of Edge’s cycle.