Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 47374 - resource unoptimized cronbase (/usr/sbin/run-crons /etc/crontab)
Summary: resource unoptimized cronbase (/usr/sbin/run-crons /etc/crontab)
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High trivial (vote)
Assignee: Jon Portnoy (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-09 12:47 UTC by Denis Knauf
Modified: 2006-10-05 17:42 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Knauf 2004-04-09 12:47:44 UTC
/usr/sbin/run-crons is a from suse copied script, which looks at some files. if this file not exist, it's run all the files in /etc/cron.*.
this happens everey minute.

i don't see any reason to do it like it's.

Reproducible: Always
Steps to Reproduce:

Actual Results:  
an unoptimized crontab. 

Expected Results:  
an optimized crontab. 

here a lite-better version of crontab: 
... 
0  *   *   *   * root /usr/sbin/run-crons /etc/cron.hourly 
1  3   *   *   * root /usr/sbin/run-crons /etc/cron.daily 
15 4   *   *   6 root /usr/sbin/run-crons /etc/cron.weekly 
30 5   1   *   * root /usr/sbin/run-crons /etc/cron.monthly 
... 
 
the /usr/sbin/run-crons: 
#!/usr/bin/perl 
foreach $dir (@ARGV) { 
  opendir DIR, $dir; 
  foreach $file (readdir DIR) { 
    next if $file =~ /^\./; 
    next if $file =~ /~$/; 
    $file = "$dir/$file"; 
    next unless -x $file; 
    system "echo $file"; 
  } 
  close DIR; 
} 
 
it isn't the most optimized way, but a start of this.
Comment 1 Denis Knauf 2004-04-09 13:06:31 UTC
in the script is a small bug. erase the echo and it will run correctly
Comment 2 Aron Griffis (RETIRED) gentoo-dev 2004-08-18 19:20:33 UTC
we're not going to use a perl version of run-crons... doesn't work for people who don't have perl.
Comment 3 Denis Knauf 2004-08-19 07:53:20 UTC
#!/bin/sh

while [ "${*}" ]
do
  dir="$1"
  shift
  [ -d "${dir}" ] || continue
  ls --color=none "${dir}" | while read file
  do
    pfile="${dir}/${file}"
    rfile="${file%\~}"
    rfile="${rfile#.}"
    [ -x "${pfile}" -a "${rfile}" == "${file}" ] || continue
    "$pfile"
  done
done
Comment 4 Denis Knauf 2004-10-09 07:17:16 UTC
the debian-way is very clean and easy: run-parts
it's a part of sys-apps/debianutils.
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2006-10-05 17:42:20 UTC
closing old bugs - cronbase has progress past this.