You are not logged in.

#1 2004-09-14 03:22:24

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

[NEW] Anacron: A cron-like periodic command scheduler

Anacron is a sheduler that is useful for system which are not continuously running (ex. laptops).  Add anacrond in the DAEMONS list in rc.conf.  The anacrontab file is set-up to run the crond jobs. Any comments would be appreciated.  tongue

PKGBUILD

pkgname=anacron
pkgver=2.3
pkgrel=1
pkgdesc="A cron-like periodic command scheduler"
url="http://sourceforge.net/projects/anacron"
license="GPL"
depends=('glibc' 'dcron')
makedepends=('sed')
source=(http://dl.sourceforge.net/sourceforge/anacron/$pkgname-$pkgver.tar.gz anacrond anacrontab)
md5sums=('865cc1dfe1ed75c470d3e6de13763f03' 'b2b69770432de46233f41ae284af2c0d'
         '058c281825c668c569a010b21da8e444')

build() {
  cd $startdir/src/$pkgname-$pkgver
  DIR=$startdir/src/$pkgname-$pkgver
  sed -e "s/const int isleap;/int isleap;/" < $DIR/gregor.c > $DIR/gregor.c.tmp
  mv $DIR/gregor.c.tmp $DIR/gregor.c
  sed -e "s=PREFIX = =PREFIX = $startdir/pkg=" < $DIR/Makefile > $DIR/Makefile.tmp
  mv $DIR/Makefile.tmp $DIR/Makefile
  make || return 1
  make prefix=$startdir/pkg/usr install
  mkdir -p $startdir/pkg/etc/rc.d
  cp $startdir/anacrond $startdir/pkg/etc/rc.d/
  cp $startdir/anacrontab $startdir/pkg/etc
}

anacrond

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

case "$1" in
  start)
    stat_busy "Starting Anacron Daemon"
    /usr/sbin/anacron -d >> /var/log/anacrond 2>&1
    if [ $? -gt 0 ]; then
      stat_fail
    else
    stat_done
    fi
    ;;
  stop)
    stat_busy "Stopping Anacron Daemon"
    stat_done
    ;;
  restart)
    $0 stop
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
esac
exit 0

anacrontab

# /etc/anacrontab
SHELL=/bin/bash
# format: period delay job-identifier command
1        5      cron.daily      run-cron /etc/cron.daily
7       10      cron.weekly     run-cron /etc/cron.weekly
30      15      cron.monthly    run-cron /etc/cron.monthly

Offline

#2 2004-09-17 16:42:22

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: [NEW] Anacron: A cron-like periodic command scheduler

There is a "bug" in the anacrontab file.  sad  The delays were really slowing the boot time. No delay would be better for the deamon. 

The new anacrontab:

# /etc/anacrontab
SHELL=/bin/bash
# format: period delay job-identifier command
1        0      cron.daily      run-cron /etc/cron.daily
7       0      cron.weekly     run-cron /etc/cron.weekly
30     0      cron.monthly    run-cron /etc/cron.monthly 

Offline

#3 2005-02-24 20:07:47

alibaba
Member
From: Graz Austria/Europe
Registered: 2004-02-12
Posts: 18

Re: [NEW] Anacron: A cron-like periodic command scheduler

The delays were really slowing the boot time. No delay would be better for the deamon. 

Why you not use

    /usr/sbin/anacron -s

in the /etc/rc.d/anacrond file ?

regards

albert

Offline

Board footer

Powered by FluxBB