Re: Aren't upgrades demanding too much restarts?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Kevin J. Cummings" <cummings@xxxxxxxxxxxxxxxxxx> writes:
> On 08/31/2010 09:08 PM, Wolfgang S. Rupprecht wrote:
>> Why not just do reboots at 3 in the morning and it just won't matter all
>> that much.  I just have a cron script in /etc/cron.daily that checks to
> No!  I'm often doing something at 3AM (granted I *should* be going to
> bed before that time), and I hate it when I'm working on something the
> the system goes down for a reboot without asking first....

I've been there too.  It used to just do a "shutdown -r +3 'a quick
reboot for yum'", but even with the 3 minute warning a pending reboot
was a real pain in the neck.  I'd often be funbling with "ps" trying
frantically to locate the shutdown so I could kill it before it killed
me. ;-)

For the curious, here is my script.  It has served me well for a few
years.

-wolfgang

#!/bin/sh
###############################################################################
##									     ##
##	File:     reboot-if-needed					     ##
##	Author:   Wolfgang S. Rupprecht <wolfgang@xxxxxxxxx>		     ##
##	Created:  Wed Dec  3 16:20:29 PST 2008				     ##
##	Contents: reboot a host if needed                                    ##
##									     ##
##	Copyright (c) 2008 Wolfgang S. Rupprecht.			     ##
##	All rights reserved.						     ##
##									     ##
##	$Id$
###############################################################################

# install reboot-if-needed /etc/cron.daily/zzzz-reboot-if-needed

# boot.log is a file we can expect to exist and is at most as old as
# the last boot-time.  If yum.log is newer, we have installed or
# deleted something.  It is best to reboot to make sure all the new
# files get used and the disk space for the old files gets freed up.

# was: /var/run/crond.pid for < fedora-12, where boot.log never was touched.
#
# The cron rpm sometimes gets updated by yum and this will cause cron
# to be restarted and the pid file to be touched.  Use boot.log if
# possible.

if [ /var/log/yum.log -nt /var/log/boot.log ]
then

    # Don't reboot if someone is logged in. 
    if [ -n "$(w -h)" ]
    then
	logger -i -s -t 'reboot-if-needed' 'Please reboot for newly installed files'
	exit
    fi

    logger -i -s -t 'reboot-if-needed' 'a quick reboot for newly installed files (via yum)'
    shutdown -r +3 'a quick reboot for newly installed files (via yum)'

fi

#
# end
#
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux