On Tuesday 13 May 2008 14:22, Bill Dodge wrote:
>I have a bash script called update that does up2date followed by a shutdown.
> The intent is to be able to update the kernel in the middle of the night
> when there is no activity on this penguin (obviously RedHat) and the users
> won't be impacted.
>
>#!/bin/bash
>up2date --update
>shutdown -r now
>
>If I do update from a terminal everything proceeds as expected but if I
> schedule update thru cron the up2date works but the shutdown never happens.
> Is there a restriction on the shutdown command? What might be the
> problem? I put the entry in root's crontab. --
The environment set up by cron is very different from that set up by a login
shell. See crontab(5) for details. It is possible that shutdown depends on
something in your login environment to work, but I'm not sure what that would
be. Perhaps the PATH?
I would recommend either setting the PATH in the shell script, or explicitly
giving absolute pathnames for the commands you invoke. Also, you probably
want it to only do the shutdown if the up2date command succeeds. If so, try:
/usr/sbin/up2date --update && /sbin/shutdown -r now
in your script.
- MacK.
-----
Edmund R. MacKenty
Software Architect
Rocket Software, Inc.
Newton, MA USA
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390