The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 05-29-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
First you want a shell script which wraps up the shutdown...

First

mkdir /root

put the following in /root/shutdown.sh


Code:
#!/bin/sh
echo trying to shutdown at `date`>>/root/shutdown.log
shutdown -h now >>/root/shutdown.log

then chmod +x /root/shutdown.sh

get the current crontab

crontab -l >crontab

edit crontab and add

when-to-do-it-according-to-crontab /root/shutdown.sh

finally

crontab crontab

then check with

crontab -l