Koozali.org: home of the SME Server

Automatic shutdown

Offline vanurk

  • *
  • 7
  • +0/-0
Automatic shutdown
« on: November 18, 2008, 10:08:00 PM »
Hi,
i would like to know if it is possible to let my server shutdown automaticly every evening at eg 23.00. I can use bios to make it startup in the morning again.
Greets Steve

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Automatic shutdown
« Reply #1 on: November 18, 2008, 10:31:30 PM »
Hi..

yes, you can.. you need 2 scripts

one in /etc (for example), like this
Code: [Select]
KO=which poweroff
echo $KO

called shut_down.sh

and another one in /etc/cron.d/ like this

Code: [Select]
# Antivirus Statistics Crond Entry
#+-----------------------Minute           (0-59)
#|    +-------------------Hour of Day    (0-23)
#|    |    +---------------Day of Month  (1-31)
#|    |    |    +-----------Month of Year (1-12)
#|    |    |    |    +-------Day of Week   (0=Sun,6=Sat)
#v   v   v   v   v
3    0   *    *   *    root    /etc/shut_down.sh

called, for example, shutdown.cron

be sure that /etc/shut_down.sh can be executed
Code: [Select]
chmod 750 /etc/shut_down.sh

HTH
Ciao
Stefano

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Automatic shutdown
« Reply #2 on: November 19, 2008, 10:37:17 AM »
Hi..

yes, you can.. you need 2 scripts

one in /etc (for example), like this
Code: [Select]
KO=which poweroff
echo $KO

called shut_down.sh

and another one in /etc/cron.d/ like this

Code: [Select]
# Antivirus Statistics Crond Entry
#+-----------------------Minute           (0-59)
#|    +-------------------Hour of Day    (0-23)
#|    |    +---------------Day of Month  (1-31)
#|    |    |    +-----------Month of Year (1-12)
#|    |    |    |    +-------Day of Week   (0=Sun,6=Sat)
#v   v   v   v   v
3    0   *    *   *    root    /etc/shut_down.sh

called, for example, shutdown.cron

be sure that /etc/shut_down.sh can be executed
Code: [Select]
chmod 750 /etc/shut_down.sh

HTH
Ciao
Stefano
Why not just use the SME Server scripts and events for it? You do not need two scripts you can just hardcode the path to the shutdown script in your crontab file, makes management and overview a little easier.
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)

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Automatic shutdown
« Reply #3 on: November 19, 2008, 10:56:14 AM »
Hi cactus..

you are right, but I wrote that script for SME 6.X and ported without any changes to SME 7.

:-)
Ciao
Stefano

Offline vanurk

  • *
  • 7
  • +0/-0
Re: Automatic shutdown
« Reply #4 on: November 19, 2008, 09:57:11 PM »
What is this SME Server scripts and events. I would like to know the easiest way. I'm not really good in linux.

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Automatic shutdown
« Reply #5 on: November 19, 2008, 10:36:16 PM »
If you really want to know more about SME, you should read (someone says twice) the documentation.. link is above ;-)

Ciao
Stefano