Hi, I was once the port maintainer of sysutils/anacron. I wrote the pkg/README file and it's been bothering me ever since.
I have attached a patch that fixes it in such a way that * Environtment variables are the same as in the default crontab for root. * Absolute paths for /bin/sh are being used. * No pipe to tee (why did I even have that?). * Suggest adding an @hourly job to run anacron in root's crontab. * Fixes @hourly and @reboot crontab suggestions so that it tests if the executable is present. Is this a good idea? Maybe it's better to let it fail, so that it's spotted? Also: * Bump revision in Makefile. With kind regards, Kusalananda
Index: Makefile =================================================================== RCS file: /cvs/ports/sysutils/anacron/Makefile,v retrieving revision 1.16 diff -u -p -u -r1.16 Makefile --- Makefile 11 Jan 2016 06:59:48 -0000 1.16 +++ Makefile 23 Feb 2017 16:35:08 -0000 @@ -6,7 +6,7 @@ V= 2.5.3 DISTNAME= anacron.$V PKGNAME= anacron-$V CATEGORIES= sysutils -REVISION= 0 +REVISION= 1 MAINTAINER= Giovanni Bechis <giova...@openbsd.org> Index: pkg/README =================================================================== RCS file: /cvs/ports/sysutils/anacron/pkg/README,v retrieving revision 1.3 diff -u -p -u -r1.3 README --- pkg/README 11 Jan 2016 06:59:48 -0000 1.3 +++ pkg/README 23 Feb 2017 16:35:08 -0000 @@ -15,17 +15,19 @@ OpenBSD daily, weekly, and monthly scrip -----Cut # ${SYSCONFDIR}/anacrontab example SHELL=/bin/sh -PATH=${PREFIX}/sbin:${PREFIX}/bin:/sbin:/bin:/usr/sbin:/usr/bin +PATH=/sbin:/bin:/usr/sbin:/usr/bin +HOME=/var/log # format: period delay job-identifier command -1 5 cron.daily sh /etc/daily 2>&1 | tee /var/log/daily.out -7 10 cron.weekly sh /etc/weekly 2>&1 | tee /var/log/weekly.out -30 15 cron.monthly sh /etc/monthly 2>&1 | tee /var/log/monthly.out +1 5 cron.daily /bin/sh /etc/daily +7 10 cron.weekly /bin/sh /etc/weekly +30 15 cron.monthly /bin/sh /etc/monthly -----Cut -Comment out the invocation of these jobs in root's crontab. +Comment out the invocation of the corresponding jobs in root's crontab +and invoke anacron as a hourly job: -If your machine is left running for more than 24h at a time, you -might also want to invoke anacron from an early morning cron job. +@hourly test -x ${PREFIX}/sbin/anacron && ${PREFIX}/sbin/anacron -s To run anacron(8) at boot time, add the following to root's crontab(5): -@reboot ${PREFIX}/sbin/anacron -ds + +@reboot test -x ${PREFIX}/sbin/anacron && ${PREFIX}/sbin/anacron -s
signature.asc
Description: PGP signature