changeset 403:39e6f675621d

Complete the documentation of the installed periodic scripts
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 25 Feb 2023 16:20:21 +0100
parents 1ccd7bf1ed06
children 6c0c9159744d
files docs/man/man8/local-bsdtools-periodic.rst
diffstat 1 files changed, 141 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/docs/man/man8/local-bsdtools-periodic.rst	Sat Feb 25 15:32:40 2023 +0100
+++ b/docs/man/man8/local-bsdtools-periodic.rst	Sat Feb 25 16:20:21 2023 +0100
@@ -17,17 +17,151 @@
 Description
 -----------
 
-The package contains a set of daily periodic scripts to
+The package contains a set of periodic scripts.
+
+All scripts are disabled by default.
+
+As all :manpage:`periodic(8)` scripts given scripts can be configured
+in :manpage:`periodic.conf(5)`.
+
+
+Daily Scripts
+~~~~~~~~~~~~~
+
+**720.local-triggered-action**
+
+  Take actions triggered by the existence of given files.
+
+  **daily_local_triggered_action_enable** (bool)
+     Set it to ``YES`` to enable this script.
+
+  **daily_local_triggered_action_files** (str)
+     The readability of any of the given files triggers the action.
+
+  **daily_local_triggered_action_condition** (str)
+     A condition to check before executing the action.
+
+     May be a Shell expression.
+
+     The list of existing trigger files -- which is a subset of
+     `daily_local_triggered_action_files` -- is available in the Shell
+     variable `TRIGGER_FILES`.
+
+  **daily_local_triggered_action_action** (str)
+     The action to execute to.
+
+     May be a Shell expression.
+
+     The list of existing trigger files -- which is a subset of
+     `daily_local_triggered_action_files` -- is available in the Shell
+     variable `TRIGGER_FILES`.
+
+  **daily_local_triggered_action_files_remove** (bool)
+     By default all existing trigger files given in
+     `daily_local_triggered_action_files` are deleted when the action
+     has been executed successfully.
+
+     Set to ``NO`` to disable this behaviour.
+
+  **daily_local_triggered_action_profiles** (str)
+     If a non-empty value is given the script executes in profile-mode.
+
+     If profiles are defined this script is re-executed once for for
+     every profile with the profile as parameter.
+
+     No other global option as `daily_local_triggered_action_enable`
+     is used.
+
+     Instead profile level configurations which are named after the
+     profile are used. The configuration variables have the form
+     `daily_local_triggered_action_${profile}_{files,condition,action,files_remove}`.
+
+     For the sake of variable evaluation some special characters in a given
+     profile are mapped to the underscore ``_``.
+
+**750.local-trim-zfs**
+
+  If enabled it automatically trims ZFS pools at regular invervals by
+  calling :command:`zpool trim`.
 
-- automatically trim ZFS pools
-- update the IPv6 neighbour cache
-- handle (file-)triggered actions (e.g. to indirectly handle certbot
-  deploy actions)
+  **daily_local_trim_zfs_enable** (bool)
+     Set to ``YES`` to enable this script.
+
+  **daily_local_trim_zfs_pool** (str)
+     The list of ZFS pool to trim to.
+
+     If empty then all known pool are trimmed.
+
+  **daliy_local_trim_zfs_default_threshold** (int)
+     The number of days between trims.
+
+     Default: 35
+
+**800.local-ipv6-refresh**
+
+  On some networks there are issuses of loosing IPv6 connectivity
+  after some uptime with BSD kernels.
+
+  This scripts helps to keep connectivity. It updates the IPv6
+  neighbour cache to ensure proper IPv6 connectivity by calling
+  :command:`traceroute6` at regular intervals.
+
+  **daily_local_ipv6_refresh_enable** (bool)
+     Set to `YES` to enable this script.
+
+  **daily_local_ipv6_refresh_flags** (str)
+     A list of flags given to :manpage:`traceroute(8)`.
+
+     Default: -n -w2 -q2 -m1 -I
+
+  **daily_local_ipv6_refresh_target** (str)
+     The target of :manpage:`traceroute6(8)`.
 
-All the periodic scripts are disabled by default.
+     If empty then `ipv6_defaultrouter` as given by :manpage:`sysrc(8)`
+     is used -- if available.
+
+
+Examples
+--------
+
+Conditions and actions can be complex Shell expressions. They are evauluated
+with `eval` in the Shell::
+
+    daily_local_triggered_action_condition="service nginx onestatus || service apache2 onestatus"
+
+    daily_local_triggered_action_action="{ service nginx onereload && service apache2 onereload ; } || true"
+
+Profiles::
+
+    daily_local_triggered_action_enable=YES
+
+    daily_local_triggered_action_profiles="p1 p2-1"
+
+    # If the file exists this is executed daily because it is not removed
+    daily_local_triggered_action_p1_files="trigger-for-p1.txt"
+    daily_local_triggered_action_p1_condition="true"
+    daily_local_triggered_action_p1_action="cat \${TRIGGER_FILES} | mail -s ALERT root"
+    daily_local_triggered_action_p1_remove_files="NO"
+
+    daily_local_triggered_action_p2_1_files="trigger-for-p2.txt"
+    daily_local_triggered_action_p2_1_condition="true"
+    daily_local_triggered_action_p2_1_action="echo 'something happened' | mail -s ALERT root"
+
+Note that the use of `TRIGGER_FILES` must be quoted in condition and
+action definitions because they are executed indirectly in the context
+of the Shell's `eval`.
 
 
 See Also
 --------
 
-:manpage:`local-bsdtools(8)`, :manpage:`periodic(8)`
+:manpage:`local-bsdtools(8)`, :manpage:`periodic(8)`,
+:manpage:`periodic.conf(5)`, :manpage:`rc.conf(5)`, :manpage:`sysrc(8)`,
+:manpage:`zpool-trim(8)`, :manpage:`traceroute(8)`
+
+
+Bugs
+----
+
+For a given profile "p1" there is no evaluation of something like
+"daily_local_triggered_action_p1_enable".