From 39711cf6c2ec5a3b4480dcb4800cc3802bda5bf2 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Fri, 20 Mar 2026 19:16:32 +0100 Subject: feat: first fully successful run e2e on straper --- straper/db/public/cron/cron.weekly/.placeholder | 2 ++ straper/db/public/cron/cron.weekly/0anacron | 12 +++++++ straper/db/public/cron/cron.weekly/man-db | 40 ++++++++++++++++++++++ straper/db/public/cron/cron.weekly/tor | 16 +++++++++ .../db/public/cron/cron.weekly/zfs-auto-snapshot | 6 ++++ 5 files changed, 76 insertions(+) create mode 100644 straper/db/public/cron/cron.weekly/.placeholder create mode 100755 straper/db/public/cron/cron.weekly/0anacron create mode 100755 straper/db/public/cron/cron.weekly/man-db create mode 100755 straper/db/public/cron/cron.weekly/tor create mode 100755 straper/db/public/cron/cron.weekly/zfs-auto-snapshot (limited to 'straper/db/public/cron/cron.weekly') diff --git a/straper/db/public/cron/cron.weekly/.placeholder b/straper/db/public/cron/cron.weekly/.placeholder new file mode 100644 index 0000000..76cb8d0 --- /dev/null +++ b/straper/db/public/cron/cron.weekly/.placeholder @@ -0,0 +1,2 @@ +# DO NOT EDIT OR REMOVE +# This file is a simple placeholder to keep dpkg from removing this directory diff --git a/straper/db/public/cron/cron.weekly/0anacron b/straper/db/public/cron/cron.weekly/0anacron new file mode 100755 index 0000000..d53cde3 --- /dev/null +++ b/straper/db/public/cron/cron.weekly/0anacron @@ -0,0 +1,12 @@ +#!/bin/sh +# +# anacron's cron script +# +# This script updates anacron time stamps. It is called through run-parts +# either by anacron itself or by cron. +# +# The script is called "0anacron" to assure that it will be executed +# _before_ all other scripts. + +test -x /usr/sbin/anacron || exit 0 +anacron -u cron.weekly diff --git a/straper/db/public/cron/cron.weekly/man-db b/straper/db/public/cron/cron.weekly/man-db new file mode 100755 index 0000000..c2a55cb --- /dev/null +++ b/straper/db/public/cron/cron.weekly/man-db @@ -0,0 +1,40 @@ +#!/bin/sh +# +# man-db cron weekly + +set -e + +if [ -d /run/systemd/system ]; then + # Skip in favour of systemd timer. + exit 0 +fi + +# This should be set by cron, but apparently isn't always; see +# https://bugs.debian.org/209185. Add fallbacks so that start-stop-daemon +# can be found. +export PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin" + +iosched_idle= +# Don't try to change I/O priority in a vserver or OpenVZ. +if ! grep -Eq '(envID|VxID):.*[1-9]' /proc/self/status && \ + { [ ! -d /proc/vz ] || [ -d /proc/bc ]; }; then + iosched_idle='--iosched idle' +fi + +if ! [ -d /var/cache/man ]; then + # Recover from deletion, per FHS. + install -d -o man -g man -m 0755 /var/cache/man +fi + +# regenerate man database +if [ -x /usr/bin/mandb ]; then + # --pidfile /dev/null so it always starts; mandb isn't really a daemon, + # but we want to start it like one. + # shellcheck disable=SC2086 + start-stop-daemon --start --pidfile /dev/null \ + --startas /usr/bin/mandb --oknodo --chuid man \ + $iosched_idle \ + -- --quiet +fi + +exit 0 diff --git a/straper/db/public/cron/cron.weekly/tor b/straper/db/public/cron/cron.weekly/tor new file mode 100755 index 0000000..c30381b --- /dev/null +++ b/straper/db/public/cron/cron.weekly/tor @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e +set -u + +DEFAULTSFILE=/etc/default/tor + +if [ -f $DEFAULTSFILE ] ; then + . $DEFAULTSFILE +fi + +if [ "${CLEANUP_OLD_COREFILES:-}" = "y" ] ; then + if [ -d /var/lib/tor ] ; then + find /var/lib/tor -mindepth 1 -maxdepth 1 -type f -mtime +21 -user debian-tor -regex '.*/core\(\.[0-9]+\)?' -exec rm '{}' + + fi +fi diff --git a/straper/db/public/cron/cron.weekly/zfs-auto-snapshot b/straper/db/public/cron/cron.weekly/zfs-auto-snapshot new file mode 100755 index 0000000..3aa977a --- /dev/null +++ b/straper/db/public/cron/cron.weekly/zfs-auto-snapshot @@ -0,0 +1,6 @@ +#!/bin/sh + +# Only call zfs-auto-snapshot if it's available +which zfs-auto-snapshot > /dev/null || exit 0 + +exec zfs-auto-snapshot --quiet --syslog --label=weekly --keep=8 // -- cgit v1.3