Koozali.org: home of the SME Server

Obsolete Releases => SME Server 7.x => Topic started by: vanurk on November 18, 2008, 10:08:00 PM

Title: Automatic shutdown
Post by: vanurk 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
Title: Re: Automatic shutdown
Post by: Stefano 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
Title: Re: Automatic shutdown
Post by: cactus 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.
Title: Re: Automatic shutdown
Post by: Stefano 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
Title: Re: Automatic shutdown
Post by: vanurk 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.
Title: Re: Automatic shutdown
Post by: Stefano 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