The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
scp automated script gholdbhurg UNIX for Advanced & Expert Users 5 10-27-2008 01:23 AM
automated ftp. sangfroid Shell Programming and Scripting 10 05-07-2007 11:52 AM
Automated FTP shauche UNIX for Advanced & Expert Users 11 07-11-2002 02:08 AM
FTP automated? n9ninchd UNIX for Dummies Questions & Answers 6 05-18-2001 10:21 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-29-2007
joe1967 joe1967 is offline
Registered User
  
 

Join Date: May 2007
Posts: 4
Smile Automated shtudown

Hi all,

I'm using Fedora and I want to be able to set my system up to shut down at a specific time ad hoc. I've been trying to do this using the cron but I can't get the init or shutdown routine to work. Can somebody confirm what the problem is ( I presume this task can be done remotely ).

Thanks.
  #2 (permalink)  
Old 05-29-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Are you claiming can't run "shutdown -h now" in a cron job? You would have to be 'root'.
  #3 (permalink)  
Old 05-29-2007
joe1967 joe1967 is offline
Registered User
  
 

Join Date: May 2007
Posts: 4
Yep, I haven't done hell of a lot of cron stuff so not very familiar with it, wondering if it's just a syntax problem in the cron or somert but I'm not getting any messages so I can't tell what's wrong
  #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
  #5 (permalink)  
Old 05-29-2007
joe1967 joe1967 is offline
Registered User
  
 

Join Date: May 2007
Posts: 4
Have set everything up.
Get "trying to shutdown at....." in the log file but not a lot else other than that...
  #6 (permalink)  
Old 05-29-2007
joe1967 joe1967 is offline
Registered User
  
 

Join Date: May 2007
Posts: 4
Eureka, I've sussed it, needed the full directory path for the shutdown comand.

Thanks for the help Porter.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 05:58 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0