Find the answer to your Linux question:
Results 1 to 3 of 3
I wrote a script that should reboot my system every hour. I put the script in the cron.hourly folder yet it doesn't seem to work. The other scripts in cron.hourly ...
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    15

    Question how do I get cron to reboot my system?

    I wrote a script that should reboot my system every hour. I put the script in the cron.hourly folder yet it doesn't seem to work. The other scripts in cron.hourly do work.

    i used nano to create the script and i used chmod 0775 to make the script executable. when i ./script it works fine. root is the owner of the script.

    the contents of the script are as follows:

    shutdown -h now


    Does anyone know what I am missing?

    I want this system to reboot every hour. I know that sounds strange but its necessary here.

  2. #2
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    PATH problem. Build the PATH up appropriately or use the FQ name:
    /sbin/shutdown

    Also, you might want to review the manpages for shutdown( 8 ). Using the -h option is not going to reboot your box.

    Quote Originally Posted by dwygant
    I want this system to reboot every hour. I know that sounds strange but its necessary here.
    May I ask why? There is almost certainly a better solution.

  3. #3
    Just Joined!
    Join Date
    Sep 2007
    Posts
    15
    Ah yes, the PATH... ok i think that did it. Thanks very much.

    Yes, the -h, of course. I actually want the system to shutdown and stay down until I bring it up manually.

    Do you know if I need a #!/bin/sh as the first line in my script?

Posting Permissions

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