Find the answer to your Linux question:
Results 1 to 4 of 4
Hey everybody, I am planning on hosting a website for people in a specific time zone. This means I don't need to have my server running when it's night and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Enthusiast Bemk's Avatar
    Join Date
    Sep 2008
    Location
    Oosterhout-NB, Netherlands
    Posts
    525

    Auto shutdown


    Hey everybody,

    I am planning on hosting a website for people in a specific time zone. This means I don't need to have my server running when it's night and people aren't viewing it. I have solved my problem of getting it to boot when power comes on, using a time switch a setting in the BIOS. The same time switch is going to take the power away from the server, but that'll mean that the server is running while it loses power.

    That can't be good. My question is: Is there a possibility to shut this thing down automatically, like 20 minutes before power is cut off. I don't want to have to shut it down every time, because I can also be on a holiday and the Server will still need to boot and shut down every time.

    I am using Ubuntu 8.04 Hardy Heron Server on a Pentium 4 machine. I am still learning about GNU/Linux and if I don't understand something, I'll just ask.

    I hope you can help me, and thanks in advance to the people who want to/will help me.

  2. #2
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Location
    Ireland
    Posts
    6,133
    You can schedule a shutdown using cron. I'd give it a bit of a read first using
    Code:
    man cron
    and the wiki article on it.

    Basically you use root's crontab to run the shutdown command. Say for instance you wanted to shutdown everynight at 11.40pm. You open crontab as root
    Code:
    sudo crontab -e
    And then add the time and command
    Code:
    # m h  dom mon dow   command
    40 23 * * * /sbin/shutdown -h now
    (The first line is the notation comment from the file, it can be ignored).

    I would read up on cron. It's not that difficult but can appear a bit alien at first.

  3. #3
    Linux Enthusiast Bemk's Avatar
    Join Date
    Sep 2008
    Location
    Oosterhout-NB, Netherlands
    Posts
    525
    Ok, I've tried, by setting the statement to be executed a few minutes in the future. Right now it is 2 minutes after the set time, and it still isn't shutting down.

    What could the problem be, do I have to start cron manually?

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Enthusiast Bemk's Avatar
    Join Date
    Sep 2008
    Location
    Oosterhout-NB, Netherlands
    Posts
    525
    Ok, after some messing around, I solved the problem. I did make the stupid mistake of not writing down all of the steps I took, so I can't make this thread to an aid for other people who are experiencing trouble with cron.

    Sorry, but thanks for the help.

Posting Permissions

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