Freevo

- User Documentation

# GeneralPlugins/Wakeupshutdown

## Plugins for automatic shutdown and wakeup

This plugins might be what your are looking for, if you do not want to have your freevo box running all the time, but nevertheless be able to record everything no matter at what time of the day it is coming.

This plugin provides a improved shutdown plugin as a replacement of the original shutdown plugin. At every shutdown it programs the system for a wakeup at the start time of the next scheduled recording. At the moment two different wakeup methodes are supported: acpi and nvram. Moreover this package also contains a second plugin named wakeupschedule.timer, which shuts down the system automatically after a certain time of idleness.

This plugin is not part of the core distribution of freevo, but it can be download at:

http://www.ikp.uni-koeln.de/~tanja/freevo/wakeupshutdown.tar.gz

Author: Tanja Striepling (owigera at web de)

To install this plugins, just copy the file `wakeupshutdown.py` to `path/to/your/freevo/src/plugins` .

### The wakeupschedule plugin

To activate and configure this plugin put the following in your `local_conf.py`:

    plugin.remove('shutdown')
    plugin.activate('wakeupshutdown',level=90)

    # To make use of this plugin you must allow a system shutdown from freevos menu
    ENABLE_SHUTDOWN_SYS = 1
    # If you enable this, you will get a warning about running or soon starting
    # recordings when you choose to shutdown the system (recommended)
    CONFIRM_SHUTDOWN    = 1
    # if you do not run freevo as root, you must use sudo for the shutdown commands
    SHUTDOWN_SYS_CMD = 'sudo shutdown -h now'
    RESTART_SYS_CMD  = 'sudo shutdown -r now'
    # choose your wakeup methode here:
    SHUTWAKEUP_METHODE = 'acpi'
    # you also need root permissions for this, so you may need to use sudo here, too
    WAKEUP_CMD = 'sudo /usr/local/bin/acpi_wakeup.sh'
    # time your system needs for the boot process
    BOOTTIME_PADDING = 180

You can choose to use acpi or nvram for the wakeup, depending on what you prefer and what methode is supported by your bios.

#### Nvram

The nvram methode uses a program which manipulates the Non-Volatile RAM of your bios. You will need the module nvram for your kernel and the program nvram-wakeup. See http://sourceforge.net/projects/nvram-wakeup for more information.

If you have one of the bioses that needs a reboot for nvram to work correctly, a reboot is done instead of a shutdown and a file is written as reboot flag. You then also need the reboothelper that comes with this plugins. Just copy the file rebootflag.py in `/path/to/your/freevo/src/helper`. Run the reboot helper in a early stage of your boot process to check for that file. If the helper finds that flag, it will remove the flag and will shutdown the system completly this time. Running freevo

    rebootflag --help

should give you some more information on the usage of this helper.

#### ACPI

An easier way is to use acpi, (if your bios supports it). This methode uses the wakeup on alarm function that most bioses have. The wakeup time is set by a simple

    echo 2004-08-02 20:15:00 >/proc/acpi/alarm

The problem is that only the time is used by the bios and not the date, this means then that your system will wakeup every day at 20:15. (For me not really a problem, because my freevo box is running once a day anyway) On most mainbords you will have to DISABLE "Wake on Timer", "Resume on Alarm", "RTC Alarm Resume" or similar things for the acpi wakeup methode to work. If you decide to use acpi, you also need the small script "acpi_wakeup.sh" which is bundled with this plugin.

### The wakeupshutdown.timer plugin

This plugin is a optional addition for the wakeupshutdown plugin for automatic shutdown of the system after a certain time of idleness.

To activate and configure this plugin put the following in your local_conf.py:

    plugin.activate('wakeupshutdown.timer')

    # after what time of idleness should the system shutdown (in secs)
    TIMER_DELAY = 1800
    # do not shutdown, if the next recording starts in less than this
    TIMER_NOSHUTDOWN_PADDING = 900
    # do not shutdown if one of this programs is running
    EXTERNAL_CMDS = ['transcode','cdrecord']

The plugin checks menu activity, running recordings and (if you provide a list) also for other programs which might be running in the background like encoding jobs.

There is a menu entry in the shutdown for pausing/resuming the timer for automatic shutdown.

last edited 2005-06-05 11:33:05 by TanjaStriepling
current version: http://freevo.sourceforge.net/cgi-bin/doc/GeneralPlugins/Wakeupshutdown