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

22711Re: [nslu2-linux] Scheduled turn-on / turn-off

Expand Messages
  • Rob Lockhart
    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


    • Show all 4 messages in this topic