From 8bf49774b8c07c777801ca763e8475f72acaeae6 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 23 May 2018 09:50:51 +0200 Subject: [PATCH] saving uncommitted changes in /etc prior to emerge run --- .etckeeper | 3 +++ anacrontab | 16 ++++++++++++++++ cron.d/0hourly | 5 +++++ cron.deny | 1 - cron.hourly/0anacron | 17 +++++++++++++++++ crontab | 20 +++++++++++--------- init.d/cronie | 1 - 7 files changed, 52 insertions(+), 11 deletions(-) create mode 100644 anacrontab create mode 100644 cron.d/0hourly create mode 100755 cron.hourly/0anacron diff --git a/.etckeeper b/.etckeeper index c8a9c8c9..17abaf67 100755 --- a/.etckeeper +++ b/.etckeeper @@ -150,6 +150,7 @@ maybe chmod 0644 'adobe/mms.cfg' maybe chmod 0600 'aiccu.conf' maybe chmod 0755 'alternatives' maybe chmod 0644 'alternatives/README' +maybe chmod 0644 'anacrontab' maybe chmod 0755 'apache2' maybe chmod 0644 'apache2/httpd.conf' maybe chmod 0644 'apache2/magic' @@ -1101,6 +1102,7 @@ maybe chgrp 'mail' 'courier/authlib/authsqliterc.dist' maybe chmod 0660 'courier/authlib/authsqliterc.dist' maybe chmod 0755 'cron.d' maybe chmod 0644 'cron.d/.keep_sys-process_cronie-0' +maybe chmod 0644 'cron.d/0hourly' maybe chmod 0644 'cron.d/living' maybe chmod 0644 'cron.d/sysstat' maybe chmod 0750 'cron.daily' @@ -1113,6 +1115,7 @@ maybe chmod 0755 'cron.daily/mlocate' maybe chmod 0644 'cron.deny' maybe chmod 0750 'cron.hourly' maybe chmod 0644 'cron.hourly/.keep_sys-process_cronbase-0' +maybe chmod 0750 'cron.hourly/0anacron' maybe chmod 0750 'cron.monthly' maybe chmod 0644 'cron.monthly/.keep_sys-process_cronbase-0' maybe chmod 0750 'cron.weekly' diff --git a/anacrontab b/anacrontab new file mode 100644 index 00000000..78c6f8c5 --- /dev/null +++ b/anacrontab @@ -0,0 +1,16 @@ +# /etc/anacrontab: configuration file for anacron + +# See anacron(8) and anacrontab(5) for details. + +SHELL=/bin/sh +PATH=/sbin:/bin:/usr/sbin:/usr/bin +MAILTO=root +# the maximal random delay added to the base delay of the jobs +RANDOM_DELAY=45 +# the jobs will be started during the following hours only +START_HOURS_RANGE=3-22 + +#period in days delay in minutes job-identifier command +1 5 cron.daily nice run-parts /etc/cron.daily +7 25 cron.weekly nice run-parts /etc/cron.weekly +@monthly 45 cron.monthly nice run-parts /etc/cron.monthly diff --git a/cron.d/0hourly b/cron.d/0hourly new file mode 100644 index 00000000..1ab8c175 --- /dev/null +++ b/cron.d/0hourly @@ -0,0 +1,5 @@ +# Run the hourly jobs +SHELL=/bin/bash +PATH=/sbin:/bin:/usr/sbin:/usr/bin +MAILTO=root +01 * * * * root run-parts /etc/cron.hourly diff --git a/cron.deny b/cron.deny index 42cdd5f8..f703d584 100644 --- a/cron.deny +++ b/cron.deny @@ -1,4 +1,3 @@ -# $Id$ # If for any reason you have users in the 'cron' group who should not # be allowed to run crontab, add them to this file (one username per # line) diff --git a/cron.hourly/0anacron b/cron.hourly/0anacron new file mode 100755 index 00000000..7bcb684b --- /dev/null +++ b/cron.hourly/0anacron @@ -0,0 +1,17 @@ +#!/bin/sh +# Check whether 0anacron was run today already +if test -r /var/spool/anacron/cron.daily; then + day=`cat /var/spool/anacron/cron.daily` +fi +if [ `date +%Y%m%d` = "$day" ]; then + exit 0; +fi + +# Do not run jobs when on battery power +if test -x /usr/bin/on_ac_power; then + /usr/bin/on_ac_power >/dev/null 2>&1 + if test $? -eq 1; then + exit 0 + fi +fi +/usr/sbin/anacron -s diff --git a/crontab b/crontab index 14a6b9b1..275f06c6 100644 --- a/crontab +++ b/crontab @@ -1,15 +1,17 @@ -# for cronie -# $Id$ - # Global variables SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ -# check scripts in cron.hourly, cron.daily, cron.weekly and cron.monthly -59 * * * * root rm -f /var/spool/cron/lastrun/cron.hourly -9 3 * * * root rm -f /var/spool/cron/lastrun/cron.daily -19 4 * * 6 root rm -f /var/spool/cron/lastrun/cron.weekly -29 5 1 * * root rm -f /var/spool/cron/lastrun/cron.monthly -*/10 * * * * root test -x /usr/sbin/run-crons && /usr/sbin/run-crons +# For details see man 4 crontabs + +# Example of job definition: +# .---------------- minute (0 - 59) +# | .------------- hour (0 - 23) +# | | .---------- day of month (1 - 31) +# | | | .------- month (1 - 12) OR jan,feb,mar,apr ... +# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat +# | | | | | +# * * * * * user-name command to be executed + diff --git a/init.d/cronie b/init.d/cronie index 781ff67c..793e6213 100755 --- a/init.d/cronie +++ b/init.d/cronie @@ -1,7 +1,6 @@ #!/sbin/openrc-run # Copyright 1999-2016 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Id$ command="/usr/sbin/crond" command_args="${CRONDARGS}" -- 2.39.5