Bug 117023 - cron.daily should not run when on battery
Summary: cron.daily should not run when on battery
Status: RESOLVED FIXED
: 147673 149575 150952 (view as bug list)
Alias: None
Product: SUSE Linux 10.1
Classification: openSUSE
Component: Mobile Devices (show other bugs)
Version: Beta 4
Hardware: Other All
: P5 - None : Enhancement (vote)
Target Milestone: ---
Assignee: Stefan Behlert
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 97395
  Show dependency treegraph
 
Reported: 2005-09-14 16:39 UTC by Forgotten User ZhJd0F0L3x
Modified: 2006-02-15 11:59 UTC (History)
8 users (show)

See Also:
Found By: Component Test
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Forgotten User ZhJd0F0L3x 2005-09-14 16:39:50 UTC
after installing a new RPM package, the system shutdown takes very long, the
machine spends lots of time in "/etc/init.d/boot.preload_early stop".

Maybe the "Laying out..." stuff should be done after package install with
SUSEconfig or something like that, but certainly not at system shutdown. This
takes much more time than the preload feature saves at boot.
Comment 1 Forgotten User ZhJd0F0L3x 2005-09-14 16:43:37 UTC
i just tested: a machine set to shut down at 1% battery, which is normally
enough to shut down, powers off hard during "Laying out..." after installing an
extra RPM.
Comment 2 Forgotten User ZhJd0F0L3x 2005-09-15 19:00:59 UTC
how about:

strolchi:/etc/init.d # diff /tmp/boot.preload_early . -u
--- /tmp/boot.preload_early     2005-09-15 20:57:43.000000000 +0200
+++ ./boot.preload_early        2005-09-15 20:58:02.000000000 +0200
@@ -15,11 +15,11 @@
 . /etc/rc.status

 rc_reset
-/usr/bin/update_preload

 case "$1" in

        start)
+               /usr/bin/update_preload &
                /sbin/preload < /var/cache/preload/boot.preload
                rc_status -v
                ;;


this makes it boot slower the next time after a package install, but it is dog
slow for shutdown now anyway and at least it will continue booting and not _stop
and wait_ for the preload cache to be rebuilt. If there is nothing to update,
update_preload is basically a noop and it does not matter if it is put into the
background.
We still should call update_preload in the yast packagemanager after a package
installation, shouldn't we?
Comment 3 Stephan Kulow 2005-09-17 09:41:50 UTC
your fix is wrong as the next line needs the file generated/updated. We need 
to introduce a SUSEconfig script and then the init script can stay as it is - 
as it's a noop if nothing changed as you say. 
Comment 4 Forgotten User ZhJd0F0L3x 2005-09-17 22:20:08 UTC
but nothing bad happens if the file is not updated yet.
I tested this on 8 machines here with different scenarios, and even if i touch
the rpm database after shutdown (from rescue system), my method is booting
faster than yours. The system can continue booting and does not have to wait for
more than one minute until the preload cache is rebuilt.
If i have to wait on boot or on shutdown does not really matter if it is not a
"battery critical" shutdown, but it just does not seem right to wait a minute on
shutdown for something we could do in the background during the next boot.
Comment 5 Marcus Moeller 2005-10-28 19:29:26 UTC
Preload Cache only needs to be updated if something new is added to /etc/preload.d - so that the preload cache ( /var/cache/preload/ ) needs to be regenerated.

You can safly turn off update_preload within init.

Perhaps we can think about a new yast module that helps adding new scripts to preload.d - but i really don't think update_preload should be executed after package installations, as newly installed packages are not automatically preloaded.

Best Regards
Marcus
Comment 6 Martin Vidner 2005-11-11 09:12:14 UTC
As a first step, please just move /usr/bin/update_preload to the start action without backgrounding it.
Comment 7 Ludwig Nussel 2005-11-11 12:01:27 UTC
What about putting it into cron.daily?
Comment 8 Forgotten User ZhJd0F0L3x 2006-02-02 14:11:27 UTC
still the same with CODE10beta3
Comment 9 Stephan Kulow 2006-02-03 11:34:32 UTC
*** Bug 147673 has been marked as a duplicate of this bug. ***
Comment 10 Stephan Kulow 2006-02-06 11:16:42 UTC
package to be submitted
Comment 11 Stephan Kulow 2006-02-09 16:31:44 UTC
*** Bug 149575 has been marked as a duplicate of this bug. ***
Comment 12 Christian Boltz 2006-02-14 23:06:05 UTC
Could you please post a short summary of the changes?
There were several suggestions when to run update_preload - which one(s) did you choose?
Comment 13 Christoph Thiel 2006-02-14 23:17:52 UTC
The udpate is triggered via cron. But after looking at the cronjob, we might still need to add a check if we are running on battery or not.
Comment 14 Stephan Kulow 2006-02-15 06:34:08 UTC
*** Bug 150952 has been marked as a duplicate of this bug. ***
Comment 15 Stephan Kulow 2006-02-15 06:35:24 UTC
Christoph is right, but I don't think this is specific to that very cron.daily
Comment 16 Stefan Behlert 2006-02-15 10:05:25 UTC
I think this is already done:

A look into /usr/lib/cron/run-crons :

#
# Don't run jobs on laptops, that are AC-offline
#
if test -x /usr/bin/on_ac_power ; then
        on_ac_power -q
        if [ "$?" = "1" ]; then
                exit 0
        fi
fi


So, if preload-scripts are now done with cron, this should be fixed. Please re-open if you see cron-jobs running on battery.
(cron-jobs gthat are NOT created by users themself)
Comment 17 Manfred Schwarb 2006-02-15 10:58:39 UTC
Just coming from Bug 150952, I don't think a cron.daily
solution is really a clever solution, at least for the /etc/preload.d/boot part.

If you have installed a new kernel, your /lib/modules/`uname -r`/...
don't exist any more, update_preload gives error messages because of this.
And the modules of the new kernel are not preloaded.

Furthermore, cron.daily is already loaded with heavy stuff, all running
at the same time.
And tweaking invocation time is a real pain, fiddling with "touch -d" in 
/var/spool/cron/lastrun.

For me, a sane, simple and working solution would just be:
--- boot.preload_early.orig     2006-02-15 10:51:37.000000000 +0000
+++ boot.preload_early  2006-02-15 10:21:58.000000000 +0000
@@ -15,12 +15,12 @@
 . /etc/rc.status

 rc_reset
-/usr/bin/update_preload

 case "$1" in

        start)
                /sbin/preload < /var/cache/preload/boot.preload
+               nice -19 /usr/bin/update_preload &
                rc_status -v
                ;;


Comment 18 Stephan Kulow 2006-02-15 11:59:01 UTC
we won't do that.