system/anacron: Added to 12.0 repository

This commit is contained in:
Michael Wagner 2010-05-11 20:01:52 +02:00 committed by Robby Workman
parent a7622c3887
commit fd299742f9
6 changed files with 170 additions and 0 deletions

36
system/anacron/README Normal file
View file

@ -0,0 +1,36 @@
anacron (periodic command scheduler)
anacron 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.
Every time Anacron is run, it reads a configuration file that
specifies the jobs Anacron controls, and their periods in days. If a
job wasn't executed in the last n days, where n is the period of that
job, Anacron executes it. Anacron then records the date in a special
timestamp file that it keeps for each job, so it can know when to run
it again. When all the executed commands terminate, Anacron exits.
It is recommended to run Anacron from the system boot-scripts. For
example, add the following lines to /etc/rc.d/rc.local:
if [ -x /usr/sbin/anacron -a -f /etc/anacrontab ]; then
/usr/sbin/anacron -s > /dev/null 2>&1
fi
This way the jobs "whose time has come" will be run shortly after the
machine boots. A delay can be specified for each job so that the
machine isn't overloaded at boot time.
In addition to running Anacron from the boot-scripts, it is also
recommended to schedule it as a daily cron-job (usually at an early
morning hour), so that if the machine is kept running for a night,
jobs for the next day will still be executed.
See anacron (8), anacrontab (5) and /usr/doc/anacron-2.3/README
for further information.

View file

@ -0,0 +1,83 @@
#!/bin/sh
# Slackware build script for anacron
# (C) 2007 Michael Wagner <lapinours@web.de>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=anacron
VERSION=2.3
ARCH=${ARCH:-i486}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
DOCS="COPYING ChangeLog README TODO"
# Omit -O2 as it is already included in the Makefile
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-march=i686 -mtune=i686"
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
# Use $SLKCFLAGS
sed -i "s,\(`grep -m 1 CFLAGS Makefile`\),\1 $SLKCFLAGS," Makefile
# "Patch" gregor.c
sed -i 's,const int isleap,int isleap,' gregor.c
make
make install PREFIX=$PKG
strip --strip-unneeded $PKG/usr/sbin/$PRGNAM 2> /dev/null
for i in $PKG/usr/man/man?/*; do
chmod 644 $i && gzip -9 $i 2> /dev/null
done
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
chmod 644 $PKG/usr/doc/$PRGNAM-$VERSION/*
# Install a default /etc/anacrontab file
mkdir -p $PKG/etc
cat $CWD/anacrontab.new > $PKG/etc/anacrontab.new
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz

View file

@ -0,0 +1,8 @@
PRGNAM="anacron"
VERSION="2.3"
HOMEPAGE="http://anacron.sourceforge.net"
DOWNLOAD="http://downloads.sourceforge.net/anacron/anacron-2.3.tar.gz"
MD5SUM="865cc1dfe1ed75c470d3e6de13763f03"
MAINTAINER="Michael Wagner"
EMAIL="lapinours@web.de"
APPROVED="rworkman"

View file

@ -0,0 +1,8 @@
# /etc/anacrontab example
# See the anacrontab(5) manpage
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/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

16
system/anacron/doinst.sh Normal file
View file

@ -0,0 +1,16 @@
# Handle configuration files
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
# List of configuration files (they should end in .new)
config etc/anacrontab.new

19
system/anacron/slack-desc Normal file
View file

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
anacron: anacron (periodic command scheduler)
anacron:
anacron: anacron executes commands at intervals specified in days.
anacron: Unlike cron, it does not assume that the system is running
anacron: continuously. It can therefore be used to control the execution of
anacron: daily, weekly and monthly jobs (or anything with a period of n days),
anacron: on systems that don't run 24 hours a day.
anacron:
anacron: Homepage: http://anacron.sourceforge.net
anacron:
anacron: