Loading ...
Sorry, an error occurred while loading the content.
 

RE: [nslu2-linux] Scheduled turn-on / turn-off

Expand Messages
  • Mario Ruprecht
    Turn off should be easy, could be probably done by a cronjob or a script based solution. But you re not saying what OS you re running on the slug. Switch on is
    Message 1 of 4 , Nov 30, 2008
      Turn off should be easy, could be probably done by a cronjob or a script based solution. But you're not saying what OS you're running on the slug.
       
      Switch on is more difficult. WakeOnLAN is not possible as it is not supported by the hardware. If you modify your slug in order to switch on automatically (described here: http://www.nslu2-linux.org/wiki/HowTo/ForcePowerAlwaysOn or here: http://www.nslu2-linux.org/wiki/HowTo/AutoPowerSlugViaUSB) you might use a timeswitch to power on the device.
       
      Anyway, the slug does not consume much power so for me this would be overkill ;-) my slugs runs 24/7.


      From: nslu2-linux@yahoogroups.com [mailto:nslu2-linux@yahoogroups.com] On Behalf Of peachtree_ccc
      Sent: Sunday, November 30, 2008 10:09 PM
      To: nslu2-linux@yahoogroups.com
      Subject: [nslu2-linux] Scheduled turn-on / turn-off

      Is there a way to schedule NSLU2 to 1) turn on and 2) turn off at
      particular times each day? I would like to build a back-up server
      where the back-up schedule corresponds to when the NSLU2 is active.

      Thanks in advance.

    • Rob Lockhart
      ... As Mario Ruprecht said, the OS needs to be specified. Hardware modifications are required for power to be restored after turning off. There are no
      Message 2 of 4 , Dec 1, 2008
        On Sun, Nov 30, 2008 at 4:08 PM, peachtree_ccc <eyurtkuran@...> wrote:
        Is there a way to schedule NSLU2 to 1) turn on and 2) turn off at
        particular times each day?  I would like to build a back-up server
        where the back-up schedule corresponds to when the NSLU2 is active.

        As Mario Ruprecht said,  the OS needs to be specified.  Hardware modifications are required for power to be restored after turning off.  There are no provisions for the on-board RTC to set that, AFAIK.

        In regards to saving power (if that's your concern), I've had some good luck with using a script like this for periodic, automated NFS backups.  Note that this is with OpenWRT (with appropriate modules opkg'ed) and this runs as a cronjob twice a day.  Some will say that I'm shortening the life of the HDD but AFAIK the killer of hard drives is HEAT (especially in a passively-cooled case).  Note that a directory called "DL" is my trigger to ensure the source and dest paths exist.  You don't want to delete all files if something quirky happens with the remote server.

        Hope that helps,
           -Rob


        #!/bin/bash
        #
        # backup drive from SRC to DST using rsync

        SRCIP=192.168.1.10
        SRC="$SRCIP:/home"
        DST="/mnt/usb_hd1"
        LOCSRC="/mnt/linux"
        RSYNC=/usr/bin/rsync
        LOG="/mnt/root/linuxbackup.log"

        test -x $RSYNC || exit 0
        echo -n "Starting Linux server rsync backup..." >>$LOG
        date >>$LOG

        if [ "`pidof rsync`" = "" ]; then
          sdparm --command=start /dev/sdb
          sleep 10
          mount -t ext2 -o noatime /dev/sdb1 $DST >>$LOG
          sleep 10
          ping -c 1 $SRCIP 2>/dev/null 1>/dev/null
          if [ $? -eq 0 ] && [ -d ${DST}/DL ]; then
            if [ ! -d ${LOCSRC}/DL ]; then
              echo "Directory " ${LOCSRC}/DL "not found; mounting." >>$LOG
                mount -t nfs $SRC $LOCSRC -o nolock
              else
               echo "Directory " ${LOCSRC}/DL "already found" >>$LOG
            fi
            if [ -d ${LOCSRC}/DL ]; then
              echo heartbeat >/sys/class/leds/nslu2\:red\:status/trigger
              echo heartbeat >/sys/class/leds/nslu2\:green\:disk-1/trigger
              nice -n 10 /usr/bin/rsync -va --delete --force --stats \
                --exclude=System\ Volume\ Information --exclude=lost+found \
                ${LOCSRC}/ ${DST}/ >>$LOG
              echo none >/sys/class/leds/nslu2\:green\:disk-1/trigger
              echo none >/sys/class/leds/nslu2\:red\:status/trigger
            else
              echo "Cannot find directory " ${LOCSRC}/DL >>$LOG
            fi
          else
            echo "Cannot ping server ${SRCIP}, or dest ${DST}/DL doesn't exist." >>$LOG
          fi
          echo "unmounting " $LOCSRC >>$LOG
          sync
          sleep 10
          umount $LOCSRC
          umount $DST
          sleep 10
          sdparm --command=stop /dev/sdb

        else
           echo "rsync currently running... stopping backup of " ${SRC} >>$LOG
        fi
        exit 0


      • MIKi
        The board of NSLU containes the required Clock chip. One wire needs to be soldered on the board only. After that the chip will be able to wake up the Slug any
        Message 3 of 4 , Dec 6, 2008
          The board of NSLU containes the required Clock chip. One wire needs to
          be soldered on the board only. After that the chip will be able to wake
          up the Slug any time as you programmed before. Pls see it here:

          http://johnarthur.wordpress.com/2008/06/26/a-battery-powered-time-lapse-
          camera/

          I am not a nLinux expert to say how to write a task, but someone can
          help you.
        Your message has been successfully submitted and would be delivered to recipients shortly.