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.
You can schedule a shutdown using cron. I'd give it a bit of a read first using
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
And then add the time and command
(The first line is the notation comment from the file, it can be ignored).
# m h dom mon dow command
40 23 * * * /sbin/shutdown -h now
I would read up on cron. It's not that difficult but can appear a bit alien at first.
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?
Ok, after some messing around, I solved the problem:banana:. 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.