The PATH that cron uses probably does not include /sbin.  You could try using 
/sbin/shutdown... in the shell script.

-----Original Message-----
From: Linux on 390 Port [mailto:[EMAIL PROTECTED] Behalf Of
Bill Dodge
Sent: Tuesday, May 13, 2008 11:23 AM
To: [email protected]
Subject: Running a bash script that does shutdown from cron


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.
-- 
Bill Dodge
email: [EMAIL PROTECTED]
Phone: (703)627-2455 

"If you don't know where you are going, any road will take you there."
Lewis Carroll
"If you don't know where you are, a map won't help" Unknown 





----------------------------------------------------------------------
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

__________________________________________________________________________________________________

CONFIDENTIALITY NOTICE: This email from the State of California is for the sole 
use of the intended recipient and may contain confidential and privileged 
information.  Any unauthorized review or use, including disclosure or 
distribution, is prohibited.  If you are not the intended recipient, please 
contact the sender and destroy all copies of this email.  

Reply via email to