debian/0000775000000000000000000000000012301260102007153 5ustar debian/dirs0000664000000000000000000000002212301257315010045 0ustar var/spool/anacron debian/default0000664000000000000000000000044212301257315010536 0ustar # If set to "yes", start anacron even when on battery power. By # default, the /etc/init.d/anacron script tries to avoid running # anacron unless on AC power, so as to avoid running down the battery. # (Things like the locate updatedb cause a lot of I/O.) ANACRON_RUN_ON_BATTERY_POWER=no debian/source/0000775000000000000000000000000012301260102010453 5ustar debian/source/format0000664000000000000000000000001412301257315011675 0ustar 3.0 (quilt) debian/anacrontab0000664000000000000000000000062112301257315011221 0ustar # /etc/anacrontab: configuration file for anacron # See anacron(8) and anacrontab(5) for details. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin HOME=/root LOGNAME=root # These replace cron's entries 1 5 cron.daily run-parts --report /etc/cron.daily 7 10 cron.weekly run-parts --report /etc/cron.weekly @monthly 15 cron.monthly run-parts --report /etc/cron.monthly debian/copyright0000664000000000000000000000215612301257315011126 0ustar This is the Debian Linux prepackaged version of the anacron utility. Anacron - run commands periodically Copyright (C) 1998 Itai Tzur Copyright (C) 1999 Sean 'Shaleh' Perry This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. anacron can be found on http://www.sourceforge.net. On Debian Linux systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2. debian/init.d0000664000000000000000000000373612301257315010310 0ustar #! /bin/sh ### BEGIN INIT INFO # Provides: anacron # Required-Start: $remote_fs $syslog $time # Required-Stop: $remote_fs $syslog $time # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: Run anacron jobs # Description: The first purpose of this script is to run anacron at # boot so that it can catch up with missed jobs. Note # that anacron is not a daemon. It is run here just once # and is later started by the real cron. The second # purpose of this script is that said cron job invokes # this script to start anacron at those subsequent times, # to keep the logic in one place. ### END INIT INFO PATH=/bin:/usr/bin:/sbin:/usr/sbin test -x /usr/sbin/anacron || exit 0 test -r /etc/default/anacron && . /etc/default/anacron . /lib/lsb/init-functions case "$1" in start) if init_is_upstart 2>/dev/null; then exit 1 fi log_daemon_msg "Starting anac(h)ronistic cron" "anacron" if test x"$ANACRON_RUN_ON_BATTERY_POWER" != x"yes" && test -x /usr/bin/on_ac_power then /usr/bin/on_ac_power >/dev/null if test $? -eq 1 then log_progress_msg "deferred while on battery power" log_end_msg 0 exit 0 fi fi # on_ac_power doesn't exist, on_ac_power returns 0 (ac power being used) # or on_ac_power returns 255 (undefined, desktop machine without APM) start-stop-daemon --start --exec /usr/sbin/anacron -- -s log_end_msg 0 ;; restart|force-reload|reload) # nothing to do : ;; stop) if init_is_upstart 2>/dev/null && status anacron 2>/dev/null | grep -q start then exit 0 fi log_daemon_msg "Stopping anac(h)ronistic cron" "anacron" start-stop-daemon --stop --exec /usr/sbin/anacron --oknodo --quiet log_end_msg 0 ;; status) exit 4 ;; *) echo "Usage: /etc/init.d/anacron {start|stop|restart|force-reload|reload}" exit 2 ;; esac exit 0 debian/changelog0000664000000000000000000006605412301260067011052 0ustar anacron (2.3-20ubuntu1) trusty; urgency=medium * Merge from Debian unstable, remaining changes: - Respect DEB_HOST_GNU_TYPE when selecting CC for cross-compiling. - call start instead of invoke-rc.d from support scripts, since invoke-rc.d is noisy when calling an upstart job. -- Dimitri John Ledkov Thu, 20 Feb 2014 01:53:59 +0000 anacron (2.3-20) unstable; urgency=medium * Team upload. [ Peter Eisentraut ] * Remove mention of LOGNAME environment variable from man page. It is not implemented. [ Shawn Landden ] * add systemd anacron.service (Closes: #688665) [ Laurent Bigonville ] * debian/anacron.service: - Serialize execution of jobs (like when started by the initscript) - Do not print output on stdout, this duplicates the messages in the logs - Run after the time-sync target - Only start the service if we are on AC power * debian/README.debian: Explain how to run anacron on battery with systemd -- Laurent Bigonville Fri, 27 Dec 2013 18:12:57 +0100 anacron (2.3-19ubuntu2) raring; urgency=low * Respect DEB_HOST_GNU_TYPE when selecting CC for cross-compiling. -- Dmitrijs Ledkovs Thu, 20 Dec 2012 11:28:01 +0000 anacron (2.3-19ubuntu1) quantal; urgency=low * Merge from Debian unstable, remaining changes: - call start instead of invoke-rc.d from support scripts, since invoke-rc.d is noisy when calling an upstart job. -- Steve Langasek Thu, 24 May 2012 20:53:01 -0700 anacron (2.3-19) unstable; urgency=low * Move source format to 3.0 (quilt) with single-debian-patch (adapted from Russ Allbery's packages) * Add native upstart support (patch from Steve Langasek) (closes: #671446) * Don't bother with starting anacron on install, since it will be started soon from cron or at boot (helps upstart support). -- Peter Eisentraut Tue, 22 May 2012 23:35:28 +0300 anacron (2.3-18ubuntu1) quantal; urgency=low * Merge from Debian unstable, remaining changes: - Replace init script with Upstart job. Do not start the job on installation, since anacron is run from cron or on boot to catch up. -- Steve Langasek Tue, 01 May 2012 04:58:15 +0000 anacron (2.3-18) unstable; urgency=low * Set charset in mails sent by anacron based on system locale, adapted from Debian cron package (closes: #602376) * Fix file descriptor leak (closes: #573387) -- Peter Eisentraut Sun, 22 Apr 2012 21:13:25 +0300 anacron (2.3-17) unstable; urgency=low * Add /etc/default/anacron to configure whether anacron should run on battery power (closes: #426294) * Set update-rc.d stop runlevel arguments to empty, to match LSB Default-Stop * Add Homepage control field * Don't run anacron jobs under nice (closes: #373950) * Set HOME and LOGNAME in default anacrontab, to get consistent environment (closes: #297678, #398819) -- Peter Eisentraut Thu, 29 Mar 2012 21:09:47 +0300 anacron (2.3-16) unstable; urgency=low [ Peter Eisentraut ] * Updated standards version * Fixed spelling in anacrontab man page * Added watch file. Kind of pointless, since upstream is abandoned, but to make all the nagging tools happy. * Removed inappropriate comments from pm-utils scripts, originally copied from apm script [ Simon Ruderich ] * Updated to debhelper level 9, thus enabling hardening flags (closes: #661012) * Fixed "implicit declaration of function" warnings which are necessary for fortify source * Fixed makefile to append to CFLAGS instead of overwriting -- Peter Eisentraut Sun, 11 Mar 2012 00:27:31 +0200 anacron (2.3-15) unstable; urgency=low * Use dh for building * Use dh_installcron for installing all cron jobs * Updated standards version * Removed unnecessary entries from debian/dirs * Set init.d Default-Stop to empty (closes: #563834) * Add Description field to init.d -- Peter Eisentraut Sun, 19 Feb 2012 14:45:27 +0200 anacron (2.3-14ubuntu1) maverick; urgency=low * Merge from Debian unstable, remaining changes: - Replace init script with Upstart job. Do not start the job on installation, since anacron is run from cron or on boot to catch up. - Bump build-dependency on debhelper for Upstart-aware dh_installinit * Dropped changes, merged in Debian: - Remove acpi-support integration, we have used pm-utils for a long time. - debian/control: postfix -> default-mta. - Edited anacrontab(5)-manpage to correctly show how to continue on next line. - Remove informational message in lock.c:consider_job() - debian/pm-utils.{power,sleep}.d: install pm-utils hook that starts/stops anacron on suspend/resume - Demote anacron's Recommends of mail-transport-agent to a Suggests; since we've been doing fine without an MTA in the desktop for some time (and want to continue doing so), this fails the definition of Recommends. * Dropped changes no longer needed in Ubuntu: - change Default-Stop to "0" in debian/init.d - removal of Ubuntu-specific acpi-support integration in preinst -- Steve Langasek Sun, 20 Jun 2010 08:04:32 +0000 anacron (2.3-14) unstable; urgency=low * New maintainers (closes: #546169, #548777) * Don't ignore errors from make clean, per lintian * Removed useless anacron.postinst file * Added Vcs control fields * Point to non-symlink version of license file, per lintian * Updated standards version * Updated to debhelper level 7 * Make init script reload action exit successfully (closes: #527885) * Properly encode backslash on anacrontab.5 man page (closes: #461784) * Removed spurious debug message in lock.c:consider_job() (closes: #480463) * Fixed incorrect use of SPOOLDIR in readtab.c (closes: #401838) * Changed mail-transport-agent to Suggests, and replaced exim4 by default-mta (closes: #490785) * Changed default syslog to rsyslog (closes: #526919) -- Peter Eisentraut Thu, 29 Oct 2009 23:46:20 +0200 anacron (2.3-13.2) unstable; urgency=low * Non-maintainer upload. * Install pm-utils hook that starts/stops anacron on suspend/resume; merged from Ubuntu (Closes: #202605) -- Peter Eisentraut Mon, 22 Jun 2009 22:22:35 +0300 anacron (2.3-13.1ubuntu11) lucid; urgency=low * rebuild rest of main for armel armv7/thumb2 optimization; UbuntuSpec:mobile-lucid-arm-gcc-v7-thumb2 -- Alexander Sack Fri, 05 Mar 2010 03:09:22 +0100 anacron (2.3-13.1ubuntu10) karmic; urgency=low * debian/upstart: anacron should not be a task, otherwise "start anacron" (as used in many scripts) will block. It's just a short-lived service. LP: #429009. -- Scott James Remnant Thu, 17 Sep 2009 20:28:52 +0100 anacron (2.3-13.1ubuntu9) karmic; urgency=low FFE LP: #427356. * Replace init script with Upstart job. - Do not start the job on installation, since anacron is run from cron or on boot to catch up. * debian/control: - Bump build-dependency on debhelper for Upstart-aware dh_installinit -- Scott James Remnant Tue, 15 Sep 2009 03:34:29 +0100 anacron (2.3-13.1ubuntu8) karmic; urgency=low * Move debian/anacron.postinst to debian/anacron.preinst and adapt $1 checks accordingly. This properly cleans up the old conffiles. (LP: #385949) -- Martin Pitt Fri, 26 Jun 2009 08:51:44 +0200 anacron (2.3-13.1ubuntu7) karmic; urgency=low * Remove acpi-support integration, we have used pm-utils for a long time: - Drop debian/acpi.d.{suspend,resume} - debian/dirs: Drop etc/acpi* - debian/rules: Don't install acpi scripts any more - debian/anacron.postinst: Remove old acpi scripts on upgrade. - LP: #366119 * debian/control: postfix -> default-mta. (See Debian #490785) -- Martin Pitt Tue, 16 Jun 2009 10:52:00 +0200 anacron (2.3-13.1ubuntu6) intrepid; urgency=low * Edited anacrontab(5)-manpage to correctly show how to continue on next line. (LP: #94432) -- Andreas Moog Tue, 02 Sep 2008 23:39:43 +0200 anacron (2.3-13.1ubuntu5) intrepid; urgency=low * Remove informational message in lock.c:consider_job() (LP: #124518) -- Andreas Moog Sun, 24 Aug 2008 11:35:37 +0200 anacron (2.3-13.1ubuntu4) intrepid; urgency=low * debian/pm-utils.{power,sleep}.d: - fix Syntax error (LP: #249220) patch from Michael Vogt thx -- Thilo Six Fri, 01 Aug 2008 17:34:06 +0200 anacron (2.3-13.1ubuntu3) intrepid; urgency=low * debian/pm-utils.{power,sleep}.d: - install pm-utils hook that starts/stops anacron on suspend/resume (LP: #249220) -- Michael Vogt Mon, 28 Jul 2008 13:44:52 +0200 cdanacron (2.3-13.1ubuntu2) intrepid; urgency=low * Demote anacron's Recommends of mail-transport-agent to a Suggests; since we've been doing fine without an MTA in the desktop for some time (and want to continue doing so), this fails the definition of Recommends. -- Steve Langasek Mon, 14 Jul 2008 09:11:41 +0000 anacron (2.3-13.1ubuntu1) intrepid; urgency=low * Merge from debian unstable, remaining changes: - make anacron work with acpi suspend/resume (LP: #36816) - Remove stop links from rc0 and rc6 - recommend postfix as default mail agent * remove "rm K11anaron" from debian/postinst, we do no longer need this as it only affects upgrades from dapper * change Default-Stop to "0" in debian/init.d -- Michael Vogt Mon, 23 Jun 2008 11:33:54 +0200 anacron (2.3-13.1) unstable; urgency=low * Non-maintainer upload to fix release goal issue. * Added LSB style dependency information in init.d script (Closes: #448223). -- Petter Reinholdtsen Sun, 9 Mar 2008 20:54:47 +0100 anacron (2.3-13ubuntu2) feisty; urgency=low * Rebuild for changes in the amd64 toolchain. * Set Ubuntu maintainer address. -- Matthias Klose Mon, 5 Mar 2007 01:13:03 +0000 anacron (2.3-13ubuntu1) feisty; urgency=low * Merge from debian unstable. -- Michael Vogt Tue, 21 Nov 2006 20:21:04 +0100 anacron (2.3-13) unstable; urgency=medium * Remove debconf remnant (Closes: #392253) -- Pascal Hakim Sat, 14 Oct 2006 18:47:00 +1000 anacron (2.3-12) unstable; urgency=medium * Removed debconf note as it's really not needed anymore. Thanks to all the people who did translations. - Removed un-needed debconf note (Closes: #388703) - Arabic (Ossama M. Khayat ) (Closes: #320761) - Danish (Claus Hindsgaul ) - Dutch (Frans Pop ) (Closes: #374267) - German (Erik Schanze ) - Italian (Luca Monducci ) (Closes: #375411) - Portuguese (Miguel Figueiredo ) (Closes: #336839) - Russian (Yuriy Talakan ) (Closes: #310069) - Spanish (Lucas Wall ) (Closes: #374312) - Swedish (Daniel Nylander ) (Closes: #331300) - Vietnamese (Clytie Siddall ) (Closes: #307740) * Fixed description to not have a leading particle (Closes: #320303) * Start anacron properly on bootup using start-stop-daemon to ensure automated installers work properly (Closes: #310797) * Clarified README.Debian to make more sense and match what's going on (Closes: #307114) * Added alternate dependency on debconf-2.0 (as per <20050802224620.GB12557@kitenet.net>) (Closes: #331739) * Changed default path to the default cron one to reduce confusion (Closes: #304327) * Bumped up the debhelper compability version to 4 * Bumped standards version to 3.7.2 * Cleaned up debian/ * Added { and } to the Usage line to make bash competition work (Closes: #350603) * Added a note about timestamp files in the spool directory in the man page. (Closes: #305424) * Fixed substition in debconf template, and make escape it properly (Closes: #366850) * Test whether anacron is executable, not just present (Closes: #378380) * Make anacron have an lsb-compliant init.d script (Closes: #384689) -- Pascal Hakim Mon, 09 Oct 2006 18:47:00 +1000 anacron (2.3-11ubuntu4) edgy; urgency=low * debian/acpi.d.resume, debian/acpi.d.suspend: - make anacron work with acpi suspend/resume (lp: 36816) -- Michael Vogt Wed, 20 Sep 2006 13:35:19 +0200 anacron (2.3-11ubuntu3) edgy; urgency=low * Remove stop links from rc0 and rc6 -- Scott James Remnant Thu, 20 Jul 2006 21:50:32 +0100 anacron (2.3-11ubuntu2) breezy; urgency=low * Recommend: postfix | mail-transport-agent -- LaMont Jones Mon, 2 May 2005 19:22:04 -0600 anacron (2.3-11ubuntu1) breezy; urgency=low * Resynchronise with Debian. -- Jeff Bailey Wed, 20 Apr 2005 11:56:06 -0400 anacron (2.3-11) unstable; urgency=low * Added @yearly target in anacrontab. (Closes: #258617) * Let an anacrontabs be multiline (Closes: #215684) * Remove dependency on an MTA (it's a recommend instead) (Closes: #252633) * Remove dependency on syslog (recommend as well) (Closes: #252633) * Fix the kill sysvinit invocations (Closes: #289547) -- Pascal Hakim Wed, 9 Feb 2005 08:08:00 +1100 anacron (2.3-10ubuntu1) hoary; urgency=low * debian/init.d: - use LSB init script functions, thanks to Ruben Vermeersch for the patch (Ubuntu bug #4118) - add output for the stop function * debian/control: depend on lsb-release -- Martin Pitt Fri, 26 Nov 2004 12:19:18 +0100 anacron (2.3-10) unstable; urgency=low * Changed current maintainer in documentation (Closes: #256590) * Added precisions to @monthly usage in anacrontab (5). (Closes: #256590) * Fixed a printf segfault when DEBUG mode is enabled (Thanks to Martin Quinson ) (Closes: #257669) * Added two variables to change the ability to change the destination and source emails for anacron emails (Thanks to Martin Quinson ) (Closes: #223337) * Translations: + Updated German (Erik Schanze ) (Closes: #250293) + Added Brazilian Portuguese (Andre Luis Lopes ) (Closes: #254107) + Added Spanish (Lucas Wall ) (Closes: #254559) + Addedd Czech (Jan Outrata ) -- Pascal Hakim Sun, 11 Jul 2004 04:52:00 +1000 anacron (2.3-9) unstable; urgency=low * Fixed priority * Added translations + Danish from Claus Hindsgaul (Closes: #242814) + Japanese from Hideki Yamane (Closes: #243268) + Italian from Luca Monducci (Closes: #249072) + German from Erik Schanze (Closes: #250293) + Dutch from Luk Claes (Closes: #250657) * Added an option to check the validity of the config file. (Closes: #248692) * Make the -t option work with non-absolute path names. * Added an extra anacrontab entry (@monthly) which can be used to schedule a job to run once a month. (Closes: #35754, #43947) * Add the ability for normal users to run anacron by specifying a spool directory. (Closes: #65853) -- Pascal Hakim Mon, 31 May 2004 23:30:00 +1000 anacron (2.3-8) unstable; urgency=low * New maintainer. A side effect of this will be to fix the email alias. (Closes: #215685) * Updated to standard versions 3.6.1.0 + Rebuild fixes /usr/share/doc symlink (Closes: #224559) * Fixed FTBFS bug. (Closes: #240043) * Added powermgmt-base to Suggests. (Closes: #137435, #140912) * Fixed up README.Debian to remove a missing example. That example is now included by default, as anacron will check the power status. (Closes: #181034) * Added debconf-isation. (Patch from Martin Quinson ) (closes: #134017) * Fixed grammar mistake. (Patch from Julian Gilbey ) (Closes: #184649) * Use invoke-rc.d instead of calling the init.d script directly (Closes: #187544) * Clarified documentation in respect to tabs and spaces in anacrontab(5). (Closes: #214314) * Include hostname in mail subject (Patch from Martin Quinson ) (Closes: #63543, #45149) * Make the From field in mails RFC2822-compliant (Patch from Santiago Villa ) (Closes: #163083) * Update depency on exim to exim4, which is the new standard mailer (Closes: #228571) * Make "/etc/init.d/anacron stop" try to stop anacron (Closes: #97969) -- Pascal Hakim Thu, 01 Apr 2004 21:30:00 +1000 anacron (2.3-7) unstable; urgency=high * forgive the delay all, life has been hectic * urgency is high because anacron no longer works if on_ac_power is missing. This was caused by the reshuffled of on_ac_power into powermgmt-base which I did not believe was going into Woody. * fixed the init.d script so it works if on_ac_power is not installed, Closes: #140911 (and a few more via merge) * postrm deletes /var/spool/anacron, Closes: #102638 -- Sean 'Shaleh' Perry Tue, 11 Jun 2002 08:20:46 -0700 anacron (2.3-6) unstable; urgency=low * update Standards version -- Sean 'Shaleh' Perry Thu, 29 Mar 2001 17:33:32 -0800 anacron (2.3-5) unstable; urgency=low * Duh, left off half the patch, Closes: #83334 -- Sean 'Shaleh' Perry Sun, 4 Feb 2001 10:35:01 -0800 anacron (2.3-4) unstable; urgency=low * Added apm event * init.d script now checks whether machine is on battery power (via APM) before starting. This saves jobs like slocate from running when you start your laptop on a place. Code used submitted by Martin Pool. Closes: #83334 * now that I ship an apm event, I removed the example -- Sean 'Shaleh' Perry Thu, 25 Jan 2001 10:05:23 -0800 anacron (2.3-3) unstable; urgency=low * Removed local dirs from default anacrontab * Changed to depeds from syslog to syslog | system-log-daemon -- Sean 'Shaleh' Perry Wed, 18 Oct 2000 07:41:27 -0700 anacron (2.3-2) unstable; urgency=low * Oops, forgot a '.' * Closes: #66161 -- Sean 'Shaleh' Perry Sat, 24 Jun 2000 11:45:15 -0700 anacron (2.3-1) unstable; urgency=low * New release -- Sean 'Shaleh' Perry Thu, 22 Jun 2000 16:02:42 -0700 anacron (2.2-2) unstable; urgency=low * Fixed clock skew check * anacron is now on sourceforge.net * anacron installs init at S89, not S20 as before. This is to match cron. * Closes: #63146, #65785, #65923 -- Sean 'Shaleh' Perry Thu, 22 Jun 2000 14:18:41 -0700 anacron (2.2-1) unstable; urgency=low * maintainer upload * Closes: #57286, #65436, #61417, #64599 * Torsten, thanks, you caught me the one time I was away from my desk (-: -- Sean 'Shaleh' Perry Tue, 13 Jun 2000 13:19:12 -0700 anacron (2.1-5.1) frozen unstable; urgency=low * Non maintainer upload. Shaleh, please forgive me, but this is a really small change and I would really hate to see reports that the installation does not work because of broken task packages... * [RC] Name exim as solution for mail-transport-agent in Depends line. Otherwise tasksel will break on the task-dialup package (closes: #64599). * I'm dumb - uploaded to unstable only *sigh* -- Torsten Landschoff Thu, 25 May 2000 20:08:37 +0200 anacron (2.1-5) unstable; urgency=low * updates for recent policy * Closes: #50255 -- Sean E. Perry Thu, 21 Nov 1999 22:17:33 -0800 anacron (2.1-4) unstable; urgency=low * Closes: #45954 -- Sean E. Perry Wed, 29 Sep 1999 11:20:12 -0700 anacron (2.1-3) unstable; urgency=low * Real FHS compliance * Closes: #33828, #34851, #39841, #43047, #44083, #44889 -- Sean E. Perry Mon, 20 Sep 1999 15:28:37 -0700 anacron (2.1-2) unstable; urgency=low * Upload for fhs compliance -- Sean E. Perry Tue, 7 Sep 1999 14:26:00 -0700 anacron (2.1-1) unstable; urgency=low * New release -- Sean E. Perry Thu, 12 Aug 1999 12:23:37 -0700 anacron (2.0.1-5) unstable; urgency=low * D'uh, closes #37344, learn to type Sean (-: -- Sean E. Perry Sun, 9 May 1999 00:21:22 -0400 anacron (2.0.1-4) unstable; urgency=low * check for anacron's existence in conffiles * clean up in rules file -- Sean E. Perry Thu, 6 May 1999 23:19:45 -0400 anacron (2.0.1-3) unstable; urgency=low * New maintainer (finally) * begin clean mode * removed rc?.d/K20anacron scripts, they were useless * switched to debhelper * closes: 23258 * closes: 24555 * closes: 26612 * closes: 32852 -- Sean E. Perry Thu, 25 Mar 1999 12:56:02 -0500 anacron (2.0.1-2) frozen unstable; urgency=low * Orphaned package * Incorporated changes from last NMR (fixes:bug#21598) -- Christian Schwarz Thu, 14 May 1998 22:49:30 +0200 anacron (2.0.1-1.1) frozen unstable; urgency=low * NMR to correct problems with build not using gcc and trying to install files somewhere other than debian/tmp and not using dpkg-shlibdeps to make sure debian/substvars (which wasn't being deleted during clean) was correct (fixes:bug#21598) -- Michael Alan Dorman Sun, 10 May 1998 11:03:33 +0500 anacron (2.0.1-1) frozen unstable; urgency=low * New upstream release (contains only bug fixes; fixes:bug#19557) * Recommend "cron (>= 3.0pl1-43)" which does not include the obsolete cronanacron script anymore * Install manual pages with correct file permissions (detected by Lintian) -- Christian Schwarz Sat, 21 Mar 1998 11:03:33 +0100 anacron (2.0-3) unstable; urgency=low * Fixed typo in Description (fixes:bug#18875) -- Christian Schwarz Fri, 6 Mar 1998 21:15:48 +0100 anacron (2.0-2) unstable; urgency=low * Added "Depends: smail | sendmail | mail-transport-agent" * Don't tag /etc/cron.d/anacron executable (fixes bug #18307) -- Christian Schwarz Tue, 17 Feb 1998 22:49:35 +0100 anacron (2.0-1) unstable; urgency=low * New upstream maintainer (Thanks to Itai Tzur for taking over upstream maintenance!) * New upstream version: - anacron has been completely rewritten in C (no perl anymore) - uses flock to lock its lock files (this fixes bug #17550) - uses syslog for logging messages * Register cron job via /etc/cron.d * Updated /etc/cron.*/0anacron* scripts to use `anacron -u' * Modified postinst script to check for existing anacron jobs in /etc/crontab * Changed "Suggests: cron" into "Recommends: cron (>= 3.0pl1-42)" * Added dependency on sysklogd * Removed cron.weekly script to rotate log files * Added new (dummy) options to etc/init.d/anacron: restart, force-reload (reported by Lintian) * Removed buggy prerm script * Updated FSF's address (reported by Lintian) * Updated package description * Added README.Debian to explain Debian specific setup * Built package with fakeroot * Upgraded package to Standards-Version 2.4.0.0 -- Christian Schwarz Mon, 16 Feb 1998 17:19:38 +0100 anacron (1.0.7) unstable; urgency=low * debian/rules: Don't use debstd anymore * debian/rules: Compress changelog file (fixes:#15442) * debian/control: Upgraded to Standards Version 2.3.0.1 * debian/control: Removed perl dependency (perl-base is tagged `Essential') -- Christian Schwarz Wed, 24 Dec 1997 13:10:52 +0100 anacron (1.0.6) unstable; urgency=low * Handle arguments for postinst (fixes #12572) * Upgraded to Standards Version 2.3.0.0 * Document two more feature requests in the TODO file -- Christian Schwarz Fri, 12 Sep 1997 02:26:17 +0200 anacron (1.0.5) unstable; urgency=low * Use little help program to run jobs: this program removes the lockfile even when the job is killed (fixes bug#12060). * Package is now arch-dependent. * postrm: remove log files when purged (fixes bug#12038). * prerm: remove spool files when purged. * Specify /etc/cron.*/*, /etc/init.d/anacron scripts as conffiles. * New file TODO which documents all feature requests: currently bug#11085. * Use debstd in debian/rules . -- Christian Schwarz Mon, 18 Aug 1997 19:31:40 +0200 anacron (1.0.4) unstable; urgency=low * Anacron is preconfigured to run the daily/weekly/monthly jobs now. * Updated description to tell the user about this. * Added "Suggests: cron". * Changed behaviour of /etc/init.d/anacron script: Just run anacron if it's later then 7:30am. * Added scripts to /etc/cron.{daily,weekly,monthly} to update anacron's time stamps (necessary if the scripts are run by cron). * Added check and message to postinst script to tell the user about adding a cron entry for anacron. * Updated README file to describe new setup. * Moved anacron script to /usr/sbin. * Upgraded to Standards-Version 2.2.0.0. -- Christian Schwarz Sat, 2 Aug 1997 19:18:53 +0200 anacron (1.0.3) unstable; urgency=low * Fixed date calculation (thanks to Itai Tzur for the patch!) * Upgraded to Standards-Version 2.1.3.3. -- Christian Schwarz Wed, 2 Jul 1997 17:48:43 +0200 anacron (1.0.2-1) unstable; urgency=low * New upstream source: improved README (fixes bug #5933). * Changed console message in /etc/init.d to apply to new standard. * Upgraded to Standards-Version 2.1.2.2. * Removed buggy check for `pe' in postinst. * Added `Replaces: pe' to control file. -- Christian Schwarz Thu, 9 Jan 1997 17:16:36 +0100 anacron (1.0.1-3) unstable; urgency=low * Changed priority from standard to extra. -- Christian Schwarz Tue, 5 Nov 1996 22:30:37 +0100 anacron (1.0.1-2) unstable; urgency=low * Upgraded to Standards-Version 2.1.1.0. -- Christian Schwarz Sat, 2 Nov 1996 20:31:12 +0100 anacron (1.0.1-1) unstable; urgency=low * Upgraded to Standards-Version 2.1.0.0. * Fixed problem when anacron was called multiple times. * Changed distribution from experimental to unstable. -- Christian Schwarz Wed, 18 Sep 1996 20:00:40 +0200 anacron (1.0-1) experimental; urgency=low * First Debian release. * Changed program name from `pe' to `anacron'. * Rewrote program and docs. -- Christian Schwarz Fri, 23 Aug 1996 22:32:33 +0200 debian/anacron.0anacron.cron.weekly0000664000000000000000000000047012301257315014473 0ustar #!/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 debian/README.debian0000664000000000000000000000155212301257316011274 0ustar Anacron for Debian ------------------ Anacron runs transparently to the system. In other words, you should never be aware that anacron and not cron is actually running cron.{daily,weekly,monthly}. Anacron itself however is not a daemon, so it will either be called at startup, on APM power status change, or by cron. Disabling those will result in some jobs not being executed on time. Anacron leaves messages in /var/log/syslog and /var/log/messages by default. By default, anacron does not run while on battery power. If you are using SysVinit, see /etc/default/anacron to change that. If you are using systemd and want to run anacron even when running on battery, you should create the following file with the specified content and then call "systemctl daemon-reload": /etc/systemd/system/anacron.service.d/on-ac.conf: [Unit] ConditionACPower= debian/control0000664000000000000000000000303612301257413010573 0ustar Source: anacron Section: admin Priority: optional Build-Depends: debhelper (>= 9.20120410), dh-systemd Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Peter Eisentraut Uploaders: Antonio Radici Standards-Version: 3.9.3 Vcs-Git: git://git.debian.org/git/collab-maint/anacron.git Vcs-Browser: http://git.debian.org/?p=collab-maint/anacron.git Homepage: http://sourceforge.net/projects/anacron/ Package: anacron Architecture: any Depends: ${shlibs:Depends}, debianutils (>= 1.7), ${misc:Depends}, lsb-base (>= 3.0-10) Replaces: pe Recommends: cron (>= 3.0pl1-43), rsyslog | system-log-daemon Suggests: default-mta | mail-transport-agent, powermgmt-base Description: cron-like program that doesn't go by time Anacron (like "anac(h)ronistic") is a periodic command scheduler. It executes commands at intervals specified in days. Unlike cron, it does not assume that the system is running continuously. It can therefore be used to control the execution of daily, weekly, and monthly jobs (or anything with a period of n days), on systems that don't run 24 hours a day. When installed and configured properly, Anacron will make sure that the commands are run at the specified intervals as closely as machine uptime permits. . This package is pre-configured to execute the daily jobs of the Debian system. You should install this program if your system isn't powered on 24 hours a day to make sure the maintenance jobs of other Debian packages are executed each day. debian/anacron.service0000664000000000000000000000024312301257316012172 0ustar [Unit] Description=Run anacron jobs After=time-sync.target ConditionACPower=true [Service] ExecStart=/usr/sbin/anacron -dsq [Install] WantedBy=multi-user.target debian/cron.d0000664000000000000000000000027412301257315010300 0ustar # /etc/cron.d/anacron: crontab entries for the anacron package SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 30 7 * * * root start -q anacron || : debian/pm-utils.power.d0000664000000000000000000000027312301257315012243 0ustar #!/bin/sh # This script makes anacron jobs start/stop when a machine gets or loses AC # power. case $1 in false) start -q anacron || : ;; true) stop -q anacron || : ;; esac debian/anacron.0anacron.cron.daily0000664000000000000000000000046712301257315014303 0ustar #!/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.daily debian/rules0000775000000000000000000000147412301257316010256 0ustar #!/usr/bin/make -f export DEB_BUILD_MAINT_OPTIONS = hardening=+all include /usr/share/dpkg/architecture.mk ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) export CC = $(DEB_HOST_GNU_TYPE)-gcc else export CC = gcc endif %: dh $@ --with=systemd override_dh_auto_install: $(MAKE) install PREFIX=debian/anacron MANDIR=debian/anacron/usr/share/man install -D -m 644 debian/anacrontab debian/anacron/etc/anacrontab install -D -m 755 debian/apm.d debian/anacron/etc/apm/event.d/anacron install -D -m 755 debian/pm-utils.power.d debian/anacron/usr/lib/pm-utils/power.d/anacron install -D -m 755 debian/pm-utils.sleep.d debian/anacron/usr/lib/pm-utils/sleep.d/95anacron override_dh_installcron: dh_installcron dh_installcron --name=0anacron override_dh_installinit: dh_installinit --no-start -u"start 89 2 3 4 5 ." debian/watch0000664000000000000000000000010712301257315010216 0ustar version=3 http://sf.net/anacron/anacron-(.+)\.tar\.gz debian uupdate debian/anacron.0anacron.cron.monthly0000664000000000000000000000047112301257315014666 0ustar #!/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.monthly debian/anacron.postrm0000664000000000000000000000025012301257315012053 0ustar #!/bin/sh set -e if [ "$1" = "purge" ]; then # here for historical reasons rm -f /var/log/anacron /var/log/anacron.[0-9]* rm -rf /var/spool/anacron fi #DEBHELPER# debian/apm.d0000664000000000000000000000132512301257315010112 0ustar #! /bin/sh # This script makes anacron jobs start to run when the machine is # plugged into AC power, or woken up. For a laptop, these are the # closest parallels to turning on a desktop. # The /etc/init.d/anacron script now normally tries to avoid running # anacron unless on AC power, so as to avoid running down the battery. # (Things like the slocate updatedb cause a lot of IO.) Rather than # trying to second-guess which events reflect having or not having # power, we just try to run anacron every time and let it abort if # there's no AC. You'll see a message on the cron syslog facility # (typically /var/log/cron) if it does run. case "$1,$2" in change,power|resume,*) start -q anacron || : ;; esac debian/patches/0000775000000000000000000000000012301260102010602 5ustar debian/patches/debian-changes0000664000000000000000000006322412301257316013401 0ustar Subject: collected Debian patches for anacron package Author: Peter Eisentraut The packaging for anacron is maintained in Git. This makes it complex to separate the changes into individual patches. They are therefore all included in a single Debian patch. For full commit history and separated commits, see the packaging Git repository. --- anacron-2.3.orig/ChangeLog +++ anacron-2.3/ChangeLog @@ -1,3 +1,8 @@ + Changes in Anacron 2.3.1 + ------------------------ +* documentation no longer suggests adding local directories to the PATH + + Changes in Anacron 2.3 ---------------------- * anacron can now read an arbitrary anacrontab file, use the -t option --- anacron-2.3.orig/Makefile +++ anacron-2.3/Makefile @@ -22,7 +22,7 @@ PREFIX = BINDIR = $(PREFIX)/usr/sbin MANDIR = $(PREFIX)/usr/man -CFLAGS = -Wall -pedantic -O2 +CFLAGS += -Wall -pedantic #CFLAGS = -Wall -O2 -g -DDEBUG # If you change these, please update the man-pages too --- anacron-2.3.orig/README +++ anacron-2.3/README @@ -40,7 +40,7 @@ scripts are scheduled to run on Sundays. off for the night or for the weekend, these scripts rarely get run. Anacron solves this problem. These jobs can simply be scheduled as -Anacron-jobs with periods of 1, 7 and 30 days. +Anacron-jobs with periods of 1, 7 and a special target called @monthly. What Anacron is not ? @@ -109,11 +109,11 @@ scripts, from cron-jobs, or explicitly. -----Cut # /etc/anacrontab example SHELL=/bin/sh -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +PATH=/sbin:/bin:/usr/sbin:/usr/bin # format: period delay job-identifier command 1 5 cron.daily run-parts /etc/cron.daily 7 10 cron.weekly run-parts /etc/cron.weekly -30 15 cron.monthly run-parts /etc/cron.monthly +@monthly 15 cron.monthly run-parts /etc/cron.monthly -----Cut 5. Put the command "anacron -s" somewhere in your boot-scripts. --- anacron-2.3.orig/TODO +++ anacron-2.3/TODO @@ -1,6 +1,3 @@ -anacron runs jobs twice in a 31 day month -add hostname to emails sent to admin -allow user anacrontabs make manpages match #defines automagically --> sed fu full ANSI / POSIX compliance code cleaning --- anacron-2.3.orig/anacron.8 +++ anacron-2.3/anacron.8 @@ -1,13 +1,15 @@ -.TH ANACRON 8 2000-06-22 "Sean 'Shaleh' Perry" "Anacron Users' Manual" +.TH ANACRON 8 2004-07-11 "Pascal Hakim" "Anacron Users' Manual" .SH NAME anacron \- runs commands periodically .SH SYNOPSIS .B anacron \fR[\fB-s\fR] [\fB-f\fR] [\fB-n\fR] [\fB-d\fR] [\fB-q\fR] -[\fB-t anacrontab\fR] [\fIjob\fR] ... +[\fB-t anacrontab\fR] [\fB-S spooldir\fR] [\fIjob\fR] ... .br -.B anacron -u [\fB-t anacrontab\fR] \fR[\fIjob\fR] ... +.B anacron [\fB-S spooldir\fR] -u [\fB-t anacrontab\fR] \fR[\fIjob\fR] ... .br .B anacron \fR[\fB-V\fR|\fB-h\fR] +.br +.B anacron -T [\fB-t anacrontab\fR] .SH DESCRIPTION Anacron can be used to execute commands periodically, with a @@ -58,7 +60,9 @@ immediately when their delay is over. T completely independent. .PP If a job generates any output on its standard output or standard error, -the output is mailed to the user running Anacron (usually root). +the output is mailed to the user running Anacron (usually root), or to +the address contained by the MAILTO environment variable in the crontab, if such +exists. .PP Informative messages about what Anacron is doing are sent to \fBsyslogd(8)\fR under facility \fBcron\fR, priority \fBnotice\fR. Error messages are sent at @@ -98,6 +102,15 @@ Suppress messages to standard error. On .B -t anacrontab Use specified anacrontab, rather than the default .TP +.B -T +Anacrontab testing. The configuration file will be tested for validity. If +there is an error in the file, an error will be shown and anacron will +return 1. Valid anacrontabs will return 0. +.TP +.B -S spooldir +Use the specified spooldir to store timestamps in. This option is required for +users who wish to run anacron themselves. +.TP .B -V Print version information, and exit. .TP @@ -115,6 +128,8 @@ by setting the TZ environment variable, file. See .B tzset(3) for more information. + +Timestamp files are created in the spool directory for each job in anacrontab. These are never removed automatically by anacron, and should be removed by hand if a job is no longer being scheduled. .SH FILES .TP .I /etc/anacrontab @@ -144,4 +159,7 @@ Anacron was originally conceived and imp The current implementation is a complete rewrite by Itai Tzur . .PP -The code base is currently maintained by Sean 'Shaleh' Perry . +The code base was maintained by Sean 'Shaleh' Perry . +.PP +Since 2004, it is maintained by Pascal Hakim . + --- /dev/null +++ anacron-2.3/anacron.apm @@ -0,0 +1,19 @@ +#! /bin/sh + +# This script makes anacron jobs start to run when the machine is +# plugged into AC power, or woken up. For a laptop, these are the +# closest parallels to turning on a desktop. + +# The /etc/init.d/anacron script now normally tries to avoid running +# anacron unless on AC power, so as to avoid running down the battery. +# (Things like the slocate updatedb cause a lot of IO.) Rather than +# trying to second-guess which events reflect having or not having +# power, we just try to run anacron every time and let it abort if +# there's no AC. You'll see a message on the cron syslog facility +# (typically /var/log/cron) if it does run. + +case "$1,$2" in +change,power|resume,*) + /etc/init.d/anacron start >/dev/null + ;; +esac --- anacron-2.3.orig/anacrontab.5 +++ anacron-2.3/anacrontab.5 @@ -1,4 +1,4 @@ -.TH ANACRONTAB 5 1998-02-02 "Itai Tzur" "Anacron Users' Manual" +.TH ANACRONTAB 5 2004-07-11 "Pascal Hakim" "Anacron Users' Manual" .SH NAME /etc/anacrontab \- configuration file for anacron .SH DESCRIPTION @@ -8,10 +8,13 @@ describes the jobs controlled by \fBanac three kinds: job-description lines, environment assignments, or empty lines. .PP -Job-description lines are of the form: +Job-description lines are of one of these two forms: .PP period delay job-identifier command .PP +.PP + @period_name delay job-identify command +.PP The .I period is specified in days, the @@ -22,7 +25,12 @@ can contain any non-blank character, exc the job in Anacron messages, and as the name for the job's timestamp file. The .I command -can be any shell command. +can be any shell command. The fields can be separated by blank spaces or tabs. +The +.I period_name +can only be set to monthly at the present time. This will ensure jobs +are only run once a month, no matter the number of days in this month, +or the previous month. .PP Environment assignment lines are of the form: .PP @@ -38,6 +46,8 @@ assignment of the same variable. .PP Empty lines are either blank lines, line containing white-space only, or lines with white-space followed by a '#' followed by an arbitrary comment. +.PP +You can continue a line onto the next line by ending it with a '\e'. .SH "SEE ALSO" .B anacron(8) .PP @@ -46,3 +56,5 @@ The Anacron file. .SH AUTHOR Itai Tzur +.PP +Currently maintained by Pascal Hakim . --- anacron-2.3.orig/global.h +++ anacron-2.3/global.h @@ -2,6 +2,7 @@ Anacron - run commands periodically Copyright (C) 1998 Itai Tzur Copyright (C) 1999 Sean 'Shaleh' Perry + Copyright (C) 2004 Pascal Hakim This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -53,9 +54,11 @@ typedef struct env_rec1 env_rec; struct job_rec1 { int period; + int named_period; int delay; char *ident; char *command; + char *mailto; int tab_line; int arg_num; @@ -75,9 +78,10 @@ typedef struct job_rec1 job_rec; extern pid_t primary_pid; extern char *program_name; extern char *anacrontab; +extern char *spooldir; extern int old_umask; extern sigset_t old_sigmask; -extern int serialize,force,update_only,now,no_daemon,quiet; +extern int serialize,force,update_only,now,no_daemon,quiet,testing_only; extern int day_now; extern int year,month,day_of_month; extern int in_background; @@ -93,6 +97,9 @@ extern job_rec **job_array; extern int running_jobs,running_mailers; +extern int complaints; + +extern char *mail_charset; /* Function prototypes */ @@ -121,7 +128,7 @@ void xcloselog(); #endif /* not DEBUG */ /* readtab.c */ -void read_tab(); +void read_tab(int cwd); void arrange_jobs(); /* lock.c */ --- anacron-2.3.orig/gregor.c +++ anacron-2.3/gregor.c @@ -2,6 +2,7 @@ Anacron - run commands periodically Copyright (C) 1998 Itai Tzur Copyright (C) 1999 Sean 'Shaleh' Perry + Copyright (C) 2004 Pascal Hakim This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,6 +24,7 @@ #include +#include #include "gregor.h" const static int @@ -65,7 +67,7 @@ day_num(int year, int month, int day) { int dn; int i; - const int isleap; /* save three calls to leap() */ + int isleap; /* save three calls to leap() */ /* Some validity checks */ @@ -114,3 +116,66 @@ leap(int year) /* but not by 400 */ return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); } + +int +days_last_month (void) +/* How many days did last month have? */ +{ + struct tm time_record; + time_t current_time; + time (¤t_time); + localtime_r (¤t_time, &time_record); + + switch (time_record.tm_mon) { + case 0: return days_in_month[11]; + case 2: return days_in_month[1] + (leap (time_record.tm_year + 1900) ? 1 : 0); + default: return days_in_month[time_record.tm_mon - 1]; + } +} + +int +days_this_month (void) +/* How many days does this month have? */ +{ + struct tm time_record; + time_t current_time; + time (¤t_time); + localtime_r (¤t_time, &time_record); + + switch (time_record.tm_mon) { + case 1: return days_in_month[1] + (leap (time_record.tm_year + 1900) ? 1 : 0); + default: return days_in_month[time_record.tm_mon]; + } +} + +int +days_last_year (void) +/* How many days this last year have? */ +{ + struct tm time_record; + time_t current_time; + time (¤t_time); + localtime_r (¤t_time, &time_record); + + if (leap(time_record.tm_year - 1 + 1900)) { + return 366; + } + + return 365; +} + +int +days_this_year (void) +/* How many days does this year have */ +{ + struct tm time_record; + time_t current_time; + time (¤t_time); + localtime_r (¤t_time, &time_record); + + if (leap(time_record.tm_year + 1900)) { + return 366; + } + + return 365; +} --- anacron-2.3.orig/gregor.h +++ anacron-2.3/gregor.h @@ -2,6 +2,7 @@ Anacron - run commands periodically Copyright (C) 1998 Itai Tzur Copyright (C) 1999 Sean 'Shaleh' Perry + Copyright (C) 2004 Pascal Hakim This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,3 +24,7 @@ int day_num(int year, int month, int day); +int days_last_month (void); +int days_this_month (void); +int days_last_year (void); +int days_this_year (void); --- anacron-2.3.orig/lock.c +++ anacron-2.3/lock.c @@ -2,6 +2,7 @@ Anacron - run commands periodically Copyright (C) 1998 Itai Tzur Copyright (C) 1999 Sean 'Shaleh' Perry + Copyirght (C) 2004 Pascal Hakim This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -111,6 +112,34 @@ consider_job(job_rec *jr) xclose(jr->timestamp_fd); return 0; } + + /* + * Check to see if it's a named period, in which case we need + * to figure it out. + */ + if (jr->named_period) + { + int period = 0, bypass = 0; + switch (jr->named_period) + { + case 1: + period = days_last_month (); + bypass = days_this_month (); + break; + case 2: + period = days_last_year (); + bypass = days_this_year (); + break; + default: + die ("Unknown named period for %s (%d)", jr->ident, jr->named_period); + } + if (day_delta < period && day_delta != bypass) + { + /* Job is still too young */ + xclose (jr->timestamp_fd); + return 0; + } + } } /* no! try to grab the lock */ --- anacron-2.3.orig/log.c +++ anacron-2.3/log.c @@ -2,6 +2,7 @@ Anacron - run commands periodically Copyright (C) 1998 Itai Tzur Copyright (C) 1999 Sean 'Shaleh' Perry + Copyright (C) 2004 Pascal Hakim This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,12 +43,16 @@ #include #include #include +#include /* for exit() */ #include "global.h" static char truncated[] = " (truncated)"; static char msg[MAX_MSG + 1]; static int log_open = 0; +/* Number of complaints that we've seen */ +int complaints = 0; + static void xopenlog() { @@ -147,6 +152,8 @@ complain(const char *fmt, ...) va_start(args, fmt); log(COMPLAIN_LEVEL, fmt, args); va_end(args); + + complaints += 1; } void @@ -158,6 +165,8 @@ complain_e(const char *fmt, ...) va_start(args, fmt); log_e(COMPLAIN_LEVEL, fmt, args); va_end(args); + + complaints += 1; } void --- anacron-2.3.orig/main.c +++ anacron-2.3/main.c @@ -2,6 +2,7 @@ Anacron - run commands periodically Copyright (C) 1998 Itai Tzur Copyright (C) 1999 Sean 'Shaleh' Perry + Copyright (C) 2004 Pascal Hakim This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +31,9 @@ #include #include #include +#include /* for exit() */ +#include +#include #include "global.h" #include "gregor.h" @@ -39,8 +43,9 @@ int year, month, day_of_month; char *program_name; char *anacrontab; +char *spooldir; int serialize, force, update_only, now, - no_daemon, quiet; /* command-line options */ + no_daemon, quiet, testing_only; /* command-line options */ char **args; /* vector of "job" command-line arguments */ int nargs; /* number of these */ char *defarg = "*"; @@ -51,6 +56,8 @@ sigset_t old_sigmask; job_rec *first_job_rec; env_rec *first_env_rec; +char *mail_charset; + static time_t start_sec; /* time anacron started */ static volatile int got_sigalrm, got_sigchld, got_sigusr1; int running_jobs, running_mailers; /* , number of */ @@ -61,17 +68,19 @@ print_version() printf("Anacron " RELEASE "\n" "Copyright (C) 1998 Itai Tzur \n" "Copyright (C) 1999 Sean 'Shaleh' Perry \n" + "Copyright (C) 2004 Pascal Hakim \n" "\n" - "Mail comments, suggestions and bug reports to ." + "Mail comments, suggestions and bug reports to ." "\n\n"); } static void print_usage() { - printf("Usage: anacron [-s] [-f] [-n] [-d] [-q] [-t anacrontab] [job] ...\n" - " anacron -u [job] ...\n" + printf("Usage: anacron [-s] [-f] [-n] [-d] [-q] [-t anacrontab] [-S spooldir] [job] ...\n" + " anacron [-S spooldir] -u [job] ...\n" " anacron [-V|-h]\n" + " anacron -T [-t anacrontab]\n" "\n" " -s Serialize execution of jobs\n" " -f Force execution of jobs, even before their time\n" @@ -82,6 +91,8 @@ print_usage() " -t Use this anacrontab\n" " -V Print version information\n" " -h Print this message\n" + " -T Test an anacrontab\n" + " -S Select a different spool directory\n" "\n" "See the manpage for more details.\n" "\n"); @@ -95,7 +106,7 @@ parse_opts(int argc, char *argv[]) quiet = no_daemon = serialize = force = update_only = now = 0; opterr = 0; - while ((opt = getopt(argc, argv, "sfundqt:Vh")) != EOF) + while ((opt = getopt(argc, argv, "sfundqt:TS:Vh")) != EOF) { switch (opt) { @@ -120,6 +131,12 @@ parse_opts(int argc, char *argv[]) case 't': anacrontab = strdup(optarg); break; + case 'T': + testing_only = 1; + break; + case 'S': + spooldir = strdup(optarg); + break; case 'V': print_version(); exit(0); @@ -351,7 +368,7 @@ record_start_time() day_of_month = tm_now->tm_mday; day_now = day_num(year, month, day_of_month); if (day_now == -1) die("Invalid date (this is really embarrassing)"); - if (!update_only) + if (!update_only && !testing_only) explain("Anacron " RELEASE " started on %04d-%02d-%02d", year, month, day_of_month); } @@ -414,21 +431,44 @@ main(int argc, char *argv[]) { int j; + int cwd; + char *cs; + anacrontab = NULL; + spooldir = NULL; if((program_name = strrchr(argv[0], '/')) == NULL) program_name = argv[0]; else ++program_name; /* move pointer to char after '/' */ + /* Get the default locale character set for the mail + * "Content-Type: ...; charset=" header + */ + setlocale(LC_CTYPE, ""); + /* "US-ASCII" is preferred to "ANSI_X3.4-1968" in MIME, even + * though "ANSI_X3.4-1968" is the official charset name. */ + if ((cs = nl_langinfo(CODESET)) && strcmp(cs, "ANSI_X3.4-1968") != 0) + mail_charset = strdup(cs); + else + mail_charset = "US-ASCII"; + setlocale(LC_CTYPE, "C"); + parse_opts(argc, argv); if (anacrontab == NULL) anacrontab = strdup(ANACRONTAB); + if (spooldir == NULL) + spooldir = strdup(SPOOLDIR); + + if ((cwd = open ("./", O_RDONLY)) == -1) { + die_e ("Can't save current directory"); + } + in_background = 0; - if (chdir(SPOOLDIR)) die_e("Can't chdir to " SPOOLDIR); + if (chdir(spooldir)) die_e("Can't chdir to %s", spooldir ); old_umask = umask(0); @@ -437,15 +477,23 @@ main(int argc, char *argv[]) if (fclose(stdin)) die_e("Can't close stdin"); xopen(0, "/dev/null", O_RDONLY); - if (!no_daemon) + if (!no_daemon && !testing_only) go_background(); else primary_pid = getpid(); record_start_time(); - read_tab(); + read_tab(cwd); + close(cwd); arrange_jobs(); + if (testing_only) + { + if (complaints) exit (1); + + exit (0); + } + if (update_only) { fake_jobs(); @@ -462,6 +510,6 @@ main(int argc, char *argv[]) launch_job(job_array[j]); } wait_children(); - explain("Normal exit (%d jobs run)", njobs); + explain("Normal exit (%d job%s run)", njobs, (njobs == 1 ? "" : "s")); exit(0); } --- anacron-2.3.orig/matchrx.c +++ anacron-2.3/matchrx.c @@ -26,6 +26,7 @@ #include #include #include +#include /* for memset() */ #include "matchrx.h" int --- anacron-2.3.orig/readtab.c +++ anacron-2.3/readtab.c @@ -2,6 +2,7 @@ Anacron - run commands periodically Copyright (C) 1998 Itai Tzur Copyright (C) 1999 Sean 'Shaleh' Perry + Copyright (C) 2004 Pascal Hakim This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -83,11 +84,23 @@ read_tab_line () Return NULL if no more lines. */ { - int c; + int c, prev=0; if (feof(tab)) return NULL; - while ((c = getc(tab)) != EOF && c != '\n') - obstack_1grow(&input_o, c); + while (1) + { + c = getc(tab); + if ((c == '\n' && prev != '\\') || c == EOF) + { + if (0 != prev) obstack_1grow(&input_o, prev); + break; + } + + if ('\\' != prev && 0 != prev && '\n' != prev) obstack_1grow(&input_o, prev); + else if ('\n' == prev) obstack_1grow(&input_o, ' '); + + prev = c; + } if (ferror(tab)) die_e("Error reading %s", anacrontab); obstack_1grow(&input_o, '\0'); return obstack_finish(&input_o); @@ -153,6 +166,7 @@ register_job(const char *periods, const } jr = obstack_alloc(&tab_o, sizeof(job_rec)); jr->period = period; + jr->named_period = 0; jr->delay = delay; jr->tab_line = line_num; jr->ident = obstack_alloc(&tab_o, ident_len + 1); @@ -171,6 +185,54 @@ register_job(const char *periods, const } static void +register_period_job(const char *periods, const char *delays, + const char *ident, char *command) +/* Store a job definition with a named period */ +{ + int delay; + job_rec *jr; + int period_len, ident_len, command_len; + + period_len = strlen(periods); + ident_len = strlen(ident); + command_len = strlen(command); + jobs_read++; + delay = conv2int(delays); + if (delay < 0) + { + complain("%s: number out of range on line %d, skipping", + anacrontab, line_num); + return; + } + + jr = obstack_alloc(&tab_o, sizeof(job_rec)); + if (!strncmp ("@monthly", periods, 7)) { + jr->named_period = 1; + } else if (!strncmp("@yearly", periods, 7)) { + jr->named_period = 2; + } else { + complain("%s: Unknown named period on line %d, skipping", + anacrontab, line_num); + } + jr->period = 0; + jr->delay = delay; + jr->tab_line = line_num; + jr->ident = obstack_alloc(&tab_o, ident_len + 1); + strcpy(jr->ident, ident); + jr->arg_num = job_arg_num(ident); + jr->command = obstack_alloc(&tab_o, command_len + 1); + strcpy(jr->command, command); + jr->job_pid = jr->mailer_pid = 0; + if (last_job_rec != NULL) last_job_rec->next = jr; + else first_job_rec = jr; + last_job_rec = jr; + jr->prev_env_rec = last_env_rec; + jr->next = NULL; + Debug(("Read job - period %d, delay=%d, ident%s, command=%s", + jr->named_period, jr->delay, jr->ident, jr->command)); +} + +static void parse_tab_line(char *line) { int r; @@ -210,6 +272,18 @@ parse_tab_line(char *line) register_job(periods, delays, ident, command); return; } + + /* A period job? */ + r = match_rx("^[ \t]*(@[^ \t]+)[ \t]+([[:digit:]]+)[ \t]+" + "([^ \t/]+)[ \t]+([^ \t].*)$", + line, 4, &periods, &delays, &ident, &command); + if (r == -1) goto reg_err; + if (r) + { + register_period_job(periods, delays, ident, command); + return; + } + complain("Invalid syntax in %s on line %d - skipping this line", anacrontab, line_num); return; @@ -219,7 +293,7 @@ parse_tab_line(char *line) } void -read_tab() +read_tab(int cwd) /* Read the anacrontab file into memory */ { char *tab_line; @@ -229,7 +303,10 @@ read_tab() jobs_read = 0; line_num = 0; /* Open the anacrontab file */ + fchdir (cwd); tab = fopen(anacrontab, "r"); + if (chdir(spooldir)) die_e("Can't chdir to %s", spooldir); + if (tab == NULL) die_e("Error opening %s", anacrontab); /* Initialize the obstacks */ obstack_init(&input_o); @@ -271,7 +348,7 @@ arrange_jobs() njobs = 0; while (j != NULL) { - if (j->arg_num != -1 && (update_only || consider_job(j))) + if (j->arg_num != -1 && (update_only || testing_only || consider_job(j))) { njobs++; obstack_grow(&tab_o, &j, sizeof(j)); --- anacron-2.3.orig/runjob.c +++ anacron-2.3/runjob.c @@ -109,7 +109,6 @@ static void run_job(const job_rec *jr) /* This is called to start the job, after the fork */ { - setup_env(jr); /* setup stdout and stderr */ xclose(1); xclose(2); @@ -153,6 +152,15 @@ static void launch_mailer(job_rec *jr) { pid_t pid; + struct stat buf; + int r; + + /* Check that we have a way of sending mail. */ + if(stat(SENDMAIL, &buf)) + { + complain("Can't find sendmail at %s, not mailing output", SENDMAIL); + return; + } pid = xfork(); if (pid == 0) @@ -173,7 +181,7 @@ launch_mailer(job_rec *jr) * options, which don't seem to be appropriate here. * Hopefully, this will keep all the MTAs happy. */ execl(SENDMAIL, SENDMAIL, "-FAnacron", "-odi", - username(), (char *)NULL); + jr->mailto, (char *)NULL); die_e("Can't exec " SENDMAIL); } /* parent */ @@ -207,19 +215,47 @@ launch_job(job_rec *jr) { pid_t pid; int fd; + char hostname[512]; + char *mailto; + + /* get hostname */ + if (gethostname(hostname, 512)) { + strcpy (hostname,"unknown machine"); + } + + setup_env(jr); + + /* Get the destination email address if set, or current user otherwise */ + mailto = getenv("MAILTO"); + + if (mailto) + jr->mailto = mailto; + else + jr->mailto = username (); /* create temporary file for stdout and stderr of the job */ fd = jr->output_fd = temp_file(); /* write mail header */ xwrite(fd, "From: "); + xwrite(fd, "Anacron <"); xwrite(fd, username()); - xwrite(fd, " (Anacron)\n"); + xwrite(fd, ">\n"); xwrite(fd, "To: "); - xwrite(fd, username()); + if (mailto) { + xwrite(fd, mailto); + } else { + xwrite(fd, username()); + } xwrite(fd, "\n"); xwrite(fd, "Subject: Anacron job '"); xwrite(fd, jr->ident); - xwrite(fd, "'\n\n"); + xwrite(fd, "' on "); + xwrite(fd, hostname); + xwrite(fd, "\n"); + xwrite(fd, "Content-Type: text/plain; charset="); + xwrite(fd, mail_charset); + xwrite(fd, "\n\n"); + jr->mail_header_size = file_size(fd); pid = xfork(); debian/patches/series0000664000000000000000000000001712301257315012031 0ustar debian-changes debian/docs0000664000000000000000000000001412301257315010035 0ustar README TODO debian/pm-utils.sleep.d0000664000000000000000000000041612301257315012216 0ustar #!/bin/sh # This script makes anacron jobs start to run when the machine is woken up. # For a laptop, these are the closest parallels to turning on a desktop. case $1 in resume|thaw) start -q anacron || : ;; suspend|hibernate) stop -q anacron || : ;; esac debian/compat0000664000000000000000000000000212301257315010365 0ustar 9 debian/upstart0000664000000000000000000000042612301257315010616 0ustar # anacron - anac(h)ronistic cron # # anacron executes commands at specific periods, but does not assume that # the machine is running continuously description "anac(h)ronistic cron" start on runlevel [2345] stop on runlevel [!2345] expect fork normal exit 0 exec anacron -s