Find the answer to your Linux question:
Results 1 to 8 of 8
I am brand new with Fedora and Linux in all. I use Macs and PCs in the past. Now I have two Fedora computers running together, I want to create ...
  1. #1
    Just Joined!
    Join Date
    May 2010
    Posts
    3

    Shutdown Script

    I am brand new with Fedora and Linux in all. I use Macs and PCs in the past. Now I have two Fedora computers running together, I want to create a script to shut both down at the same time. How do I do this, Say I wanted to have them both shut down by midnight every night. How would I go about doing this? I created a script for windows to do this, but that is completely different from Linux. I run the latest fedora, and no absolutely nothing about scripting in linux.


    Thanks For any help

  2. #2
    Just Joined!
    Join Date
    May 2010
    Posts
    10

    Exclamation

    You can use crontab for auto task...

    In your case. EXample use crontab...

    59 23 * * * /sbin/shutdown -h now

    Mean:

    at 23h59min, all days of month, all month of year and all day of week

    Your system will auto shutdown...

    Best regard...

  3. #3
    Just Joined!
    Join Date
    Dec 2006
    Posts
    6
    Quote Originally Posted by kingcasino View Post
    You can use crontab for auto task...

    In your case. EXample use crontab...

    59 23 * * * /sbin/shutdown -h now

    Mean:

    at 23h59min, all days of month, all month of year and all day of week

    Your system will auto shutdown...

    Best regard...
    Let me correct you,

    59 23 * * * "/sbin/shutdown -h now"

    Sometimes its does not work without quotes. It will shutdown your PC everyday at 11:59PM. You can adjust your timing as per yr requirements.

    -Ramesh

  4. #4
    Just Joined!
    Join Date
    May 2010
    Posts
    10

    Question

    OH,

    I miss " "

    Thanks Ramesh

  5. #5
    Just Joined!
    Join Date
    Feb 2009
    Posts
    5

    investigate cron

    Jic you didn't - investigate cron and crontab. The previous replies gave you a very specific reply - and a good one. The general reply is that cron holds the key to the your question's answer.

  6. #6
    Just Joined!
    Join Date
    May 2010
    Posts
    3
    Thanks guys,

    So I have looked into the crontab. I created the crontab by going into my terminal typing crontab -e and then it brings up what looks to me a vi screen. From here I type in what I want the crontab to do (what you guys gave me). so just

    59 23 * * * /sbin/shutdown -h now (I tried with and with out quotations)

    Then I hold shift + ZZ to save and exit, it then goes back to the terminal and says

    crontab: installing new crontab

    But then it never executes. my computer never shuts down. If I type crontab -l to see what I have it shows

    59 23 * * * /sbin/shutdown -h now ....so it is there

    What am I doing wrong?

    Thanks for everything so far

  7. #7
    Just Joined!
    Join Date
    May 2010
    Posts
    10

    Exclamation

    Hi Beencountry,

    You type following command and test it again:

    59 23 * * * "/sbin/shutdown -h now"
    ---- Note: " "

    Good luck !

  8. #8
    Just Joined!
    Join Date
    May 2010
    Posts
    3
    Sorry I don't mean to seem like a pain, But Yea I copied and pasted that, and it still didn't work. I got to be doing something wrong I'm not sure, Is there maybe a script I can write that will do this? A script that will either create the crontab or one that will just simply shut down the computer?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...