From 105956f8e6a53ef12ad7d2561e6f414ebd4f77bb Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Wed, 6 Oct 2021 13:24:13 -0400 Subject: [PATCH] Closes #7464: Improve documentation for executing housekeeping task as a cron job --- docs/administration/housekeeping.md | 11 +++++++++-- docs/installation/3-netbox.md | 4 ++-- docs/installation/upgrading.md | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/docs/administration/housekeeping.md b/docs/administration/housekeeping.md index c562613eb..9a3444ca0 100644 --- a/docs/administration/housekeeping.md +++ b/docs/administration/housekeeping.md @@ -5,6 +5,13 @@ NetBox includes a `housekeeping` management command that should be run nightly. * Clearing expired authentication sessions from the database * Deleting changelog records older than the configured [retention time](../configuration/optional-settings.md#changelog_retention) -This command can be invoked directly, or by using the shell script provided at `/opt/netbox/contrib/netbox-housekeeping.sh`. This script can be copied into your cron scheduler's daily jobs directory (e.g. `/etc/cron.daily`) or referenced directly within the cron configuration file. +This command can be invoked directly, or by using the shell script provided at `/opt/netbox/contrib/netbox-housekeeping.sh`. This script can be linked from your cron scheduler's daily jobs directory (e.g. `/etc/cron.daily`) or referenced directly within the cron configuration file. -The `housekeeping` command can also be run manually at any time: Running the command outside of scheduled execution times will not interfere with its operation. +```shell +ln -s /opt/netbox/contrib/netbox-housekeeping.sh /etc/cron.daily/netbox-housekeeping +``` + +!!! note + On Debian-based systems, be sure to omit the `.sh` file extension when linking to the script from within a cron directory. Otherwise, the task may not run. + +The `housekeeping` command can also be run manually at any time: Running the command outside scheduled execution times will not interfere with its operation. diff --git a/docs/installation/3-netbox.md b/docs/installation/3-netbox.md index d20bfaf6b..87a64b325 100644 --- a/docs/installation/3-netbox.md +++ b/docs/installation/3-netbox.md @@ -259,10 +259,10 @@ python3 manage.py createsuperuser NetBox includes a `housekeeping` management command that handles some recurring cleanup tasks, such as clearing out old sessions and expired change records. Although this command may be run manually, it is recommended to configure a scheduled job using the system's `cron` daemon or a similar utility. -A shell script which invokes this command is included at `contrib/netbox-housekeeping.sh`. It can be copied to your system's daily cron task directory, or included within the crontab directly. (If installing NetBox into a nonstandard path, be sure to update the system paths within this script first.) +A shell script which invokes this command is included at `contrib/netbox-housekeeping.sh`. It can be copied to or linked from your system's daily cron task directory, or included within the crontab directly. (If installing NetBox into a nonstandard path, be sure to update the system paths within this script first.) ```shell -cp /opt/netbox/contrib/netbox-housekeeping.sh /etc/cron.daily/ +ln -s /opt/netbox/contrib/netbox-housekeeping.sh /etc/cron.daily/netbox-housekeeping ``` See the [housekeeping documentation](../administration/housekeeping.md) for further details. diff --git a/docs/installation/upgrading.md b/docs/installation/upgrading.md index 9854afeb4..d59aa50a2 100644 --- a/docs/installation/upgrading.md +++ b/docs/installation/upgrading.md @@ -111,10 +111,10 @@ sudo systemctl restart netbox netbox-rq ## Verify Housekeeping Scheduling -If upgrading from a release prior to NetBox v3.0, check that a cron task (or similar scheduled process) has been configured to run NetBox's nightly housekeeping command. A shell script which invokes this command is included at `contrib/netbox-housekeeping.sh`. It can be copied to your system's daily cron task directory, or included within the crontab directly. (If NetBox has been installed in a nonstandard path, be sure to update the system paths within this script first.) +If upgrading from a release prior to NetBox v3.0, check that a cron task (or similar scheduled process) has been configured to run NetBox's nightly housekeeping command. A shell script which invokes this command is included at `contrib/netbox-housekeeping.sh`. It can be linked from your system's daily cron task directory, or included within the crontab directly. (If NetBox has been installed in a nonstandard path, be sure to update the system paths within this script first.) ```shell -cp /opt/netbox/contrib/netbox-housekeeping.sh /etc/cron.daily/ +ln -s /opt/netbox/contrib/netbox-housekeeping.sh /etc/cron.daily/netbox-housekeeping ``` See the [housekeeping documentation](../administration/housekeeping.md) for further details.