Configuring a Nightly Job

Note

This guide assumes that you have already installed SteamPrefill on your system. If you have not yet installed SteamPrefill, see Linux Setup Guide

Configuring The Schedule

We will first need to configure a timer which will configure the schedule that SteamPrefill will run on. In this example, we will setup a schedule that will run nightly at 4am local time.

You should create a new file named /etc/systemd/system/steamprefill.timer, and save the following configuration into that file.

[Unit]
Description=SteamPrefill run daily
Requires=steamprefill.service

[Timer]
# Runs every day at 4am (local time)
OnCalendar=*-*-* 4:00:00

# Set to true so we can store when the timer last triggered on disk.
Persistent=true

[Install]
WantedBy=timers.target

Configuring The Job

Next, we will setup the job that will be triggered nightly by the timer that we previously setup. Create a new file /etc/systemd/system/steamprefill.service, and save the following configuration into the file.

Note

The values of User, WorkingDirectory, and ExecStart will need to be configured to point to your SteamPrefill install location.

[Unit]
Description=SteamPrefill
After=remote-fs.target
Wants=remote-fs.target

[Service]
# Replace with your username
User=

# Set this to the directory where SteamPrefill is installed.
# Example : /home/tim/SteamPrefill
WorkingDirectory=

# This should be the full path to SteamPrefill, as well as any additional option flags
# Example: /home/tim/SteamPrefill/SteamPrefill prefill --no-ansi
ExecStart=

Type=oneshot
Nice=19

[Install]
WantedBy=multi-user.target

Once these two files are setup, you can enable the scheduled job with:

sudo systemctl daemon-reload
sudo systemctl enable --now steamprefill.timer
sudo systemctl enable steamprefill

If everything was configured correctly, you should see similar output from running sudo systemctl status steamprefill.timer



Checking Service Logs

It is possible to check on the status of the service using sudo systemctl status steamprefill, which will display both the service's status as well as its most recent logs.