Koozali.org: home of the SME Server

automatic shutdown

Offline Maniac

  • *
  • 15
  • +0/-0
automatic shutdown
« on: April 10, 2007, 11:29:45 AM »
hi everyone!

I couldn't find a solution for this problem, so I'm posting here:

Is it possible to let the server automatically shut down every day at a specific time?
Starting up is no porblem, this is easy to setup by bios.

Is there a plugin or something?

thanks, Maniac

Offline byte

  • *
  • 2,183
  • +2/-0
automatic shutdown
« Reply #1 on: April 10, 2007, 11:45:18 AM »
Quote
Is it possible to let the server automatically shut down every day at a specific time?


You can set up a cron job to do this.
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

Offline william_syd

  • *****
  • 1,608
  • +0/-0
  • Nothing to see here.
    • http://www.magicwilly.info
automatic shutdown
« Reply #2 on: April 10, 2007, 03:57:29 PM »
Yes, you will need to run the 'shutdown' command in a cron job.

Do a 'man shutdown' to see how to use it.

An alternative is 'signal-event halt' , also run as a cron job.

Are you certain that your bios can wake up at a certain time everyday ?
Regards,
William

IF I give advise.. It's only if it was me....

Offline Maniac

  • *
  • 15
  • +0/-0
automatic shutdown
« Reply #3 on: April 11, 2007, 09:23:04 AM »
ok thanks, I'll try this..

Yes, I tried it. The function in the bios is called "wake up by date"

Offline Maniac

  • *
  • 15
  • +0/-0
automatic shutdown
« Reply #4 on: April 15, 2007, 12:50:43 AM »
It took some time today (cause I'm a noob  :wink: )but now the Server starts accurately at 10 o'clock and shuts down at 0, friday and saturday at 2.
This will save a lot of energy over time.  

my crontab file:

MAILTO=root
HOME=/

0 0 * * 1-4,7 shutdown -h now
0 2 * * 5-6 shutdown -h now

For germans who are interested: http://www.selflinux.org/selflinux/html/cron01.html#d63e59

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
automatic shutdown
« Reply #5 on: April 15, 2007, 11:12:32 AM »
Quote from: "Maniac"
It took some time today (cause I'm a noob  :wink: )but now the Server starts accurately at 10 o'clock and shuts down at 0, friday and saturday at 2.
This will save a lot of energy over time.  

my crontab file:

MAILTO=root
HOME=/

0 0 * * 1-4,7 shutdown -h now
0 2 * * 5-6 shutdown -h now

For germans who are interested: http://www.selflinux.org/selflinux/html/cron01.html#d63e59
I advice you to use the signal-event halt instead of the shutdown command, as this is a SME Server specific event which might handle other things which are not done with the shutdown command (no wor in the future).

My advice is not to do shutdown/start-up stuff like this as you risk loss of data and corruption of data, this might in the end cost you more than your energy bill.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)