Skip to main content
Version: v17.x - Umbraco 17

uSync.Hangfire

uSync.Hangfire is a library that helps you run uSync commands as part of hangfire jobs inside Umbraco.

To use this package you need the Cultiv.Hangfire package.

uSync.Hangfire contains helpers for the core uSync package that allow you to run imports or exports via hangfire.

To download uSync.Hangfire via the command-line, enter:

dotnet add pacakge uSync.Hangfire

uSync.Hangfire allows you to run imports or exports via hangfire. For example, to add a hangfire job to export once a day, you could add this code to a composer:

builder.AddDailySyncExportJob("Daily Export", 17, 10);

uSync.Complete.Hangfire

uSync.Complete.Hangfire contains helpers for uSync.Complete.

dotnet add package uSync.Complete.Hangfire

This allows you to do more cool things, such as create a restore point, and Push or pull content, media, and everything else between servers.

Create a Restore Point

For example, to create a restore point, you would use this code:

builder.CreateDailyRestorePointJob("Daily Restore Point", 02, 00);

Push All Content Once a Day

Or to push all of the content and media to another site once a day, you would use this code:

builder.CreatePushAllContentAndMediaJob("Daily Site Sync", "Target", 04, 00);

Specify Content and Media for Push/Pull

You can also do things like specify which bit of content or media to use as the root for the push or the pull:

builder.CreatePullMediaJob("Pull Backgrounds folder", // name for Hangfire.
"Target", // alias of the server.
Guid.Parse("f2b3c1d4-5e6f-7a8b-9c0d-e1f2g3h4i5j6"), // guid of the folder to start from.
DependencyFlags.IncludeChildren, // flags (like include child items)
05, 00); // time of day (5 AM)

Helpers and Sample Code

You can do plenty more complicated things with this package, and there are lots of helpers and sample code

The uSyncSource.Site/Scheduled github page contains some basic commands for a website.