Jump to content

Flibblebot

Members
  • Posts

    64
  • Joined

  • Last visited

Posts posted by Flibblebot

  1. As someone who has spent most of his working life in the high-end IT market, a vendor tends to be someone who just sells boxes with no or little add-on. A reseller tends to have consultancy and/or support bolted on and offer a more bespoke service than the vendors (AKA box-shifters). The people who build their own hardware with another company's software on top are called OEMs (although OEM is more of a PC term and doesn't really appear much in the high-end IT market).

  2. You've got two options - you could put your server into S3 sleep but leave it powered on 24/7, then just wake it up from another workstation with the Wake-On LAN magic packet.

     

    Alternatively, you could use a cron job to shut your server down at a certain time and use a timer on the power socket to turn the power off a few minutes later then back on again in the morning. You'll need to change the power loss settings in the BIOS to "Always on" or similar.

     

    Just bear in mind that the second method isn't really possible at the moment, because there's no safe way to shut down the server from the command line at the moment (AFAIK)

  3. As stated elsewhere on the forums, Tom is working on updating the Wiki documentation. Once that is done, he'll release 5.0-stable into the wild.

     

    Yes, it's taking a bit of time, but wouldn't you rather have a stable release together with complete and up-to-date documentation?

  4. It's a matter of style and is just an example.

    I was thinking more along the lines that in your original example, emhttp would be run in safe mode but not in normal mode? Shouldn't it be:

    # Load emhttp before anything else - we always need that running ;-)
    /usr/local/sbin/emhttp &
    
    # If "unraidsafemode" present on kernel command line, skip all add-ons
    if grep -wq unraidsafemode /proc/cmdline ; then
      logger "unRAID Safe Mode (unraidsafemode) has been set"
    
      #Do your critical safe mode code here. then exit.
      #e.g.
      #/boot/unmenu/uu
      exit
    else
      #Other code if not in safe mode. 
    fi
    

  5. The easiest way is to add the sleep command to your crontab file.

    Add the following lines your go script:

    # Set a daily sleep in root's crontab:
    
    # Append new entries to root's crontab:
    cat <<-EOF >> /tmp/crontab.root
    
    # Send server to sleep at 23:15 every day
    15 23 * * * echo -n mem > /sys/power/state
    
    EOF
    
    # Update root's crontab:
    cp /tmp/crontab.root /var/spool/cron/crontabs/root-
    crontab /tmp/crontab.root -u root

     

    You may want to do a few other things, such as check for network or activity, run the mover before sleeping, etc. You'd need to put these things in a script and call the script from cron instead. Take a look here for further information - although read through to the end of the thread, as there are a few changes that need to be made to the posted script.

     

    I don't know how you'd go about waking the server up at a specified time - I think you'd have to get another machine to send a WOL command at 6am?

  6. It doesn't necessarily have to be the motherboard - it could be that the PSU has died, or at least died enough that  it can't power everything in the system (I've had that happen a few times before. Found out the expensive way first time round, learnt my lesson next time it happened ;) )

  7. Are you wanting your unRAID server to wake up other machines or be woken up by other machines.

     

    If it's the latter, there are scripts available on this site and in the Wiki to put your unRAID server to sleep when there's no activity. Check here for more info.

     

    If it's the former, there are scripts available that will wake up other machines. Here's a Python one I use on my main server (to wake my unRAID server up before starting a backup). I can't remember where I got it from.

    exec /usr/bin/python -x "$0" "$@"
    # -*- coding: ISO-8859-15 -*-
    #
    # wake-on-lan
    # $Id: wake-on-lan.cin,v 1.0 2010/02/20 15:05:42 das Exp $
    # S. Das, London
    
    ## --- Local nodes -------------------------- ##
    ## Modify this to put your own hostname/MAC
    ## address pair here. The format is:
    ## "abc xx:xx:xx:xx:xx:xx", where "abc" could
    ## be any name you like and the "xx:xx..." is
    ## the MAC address of the machine the magic
    ## packet is going to be sent.
    
    node_lst = [
            'tower XX:XX:XX:XX:XX:XX',
    ]
    
    ## --- don't change anything below --------- ##
    
    import os,sys,string,commands
    import struct, socket
    import re,random
    
    retval = 0
    
    X = '([a-fA-F0-9]{2}[\-|.]?){5}[a-fA-F0-9]{2}$'
    S = re.compile(r'\s+')
    E = re.compile('^$')
    
    mmap = {}
    
    ## First argument 'None' in str.translate is new in 2.6.
    ## Previously, it was a string of 256 characters.
    if sys.version_info < (2, 6):
        f1_arg = ''.join(chr(i) for i in xrange(256))
    else:
        f1_arg = None
    
    def WakeOnLan(mac_address):
    
        ## Building the Wake-On-LAN "Magic Packet"...
        ## Pad the synchronization stream.
        data = ''.join(['FFFFFFFFFFFF', mac_address * 20])
        msg = ''
    
        ## Split up the hex values and pack.
        for i in range(0, len(data), 2):
            msg = ''.join([msg, struct.pack('B', int(data[i: i + 2], 16))])
    
        ## ...and send it to the broadcast address using UDP
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
        s.sendto(msg, ('255.255.255.255', 9))
        s.close()
    
    def sys_exit():
        sys.stdout.flush()
        sys.exit(1)
    
    ## check if hostname is provided
    if len(sys.argv) != 2:
        print "Usage: %s <hostname>" % sys.argv[0]
        sys_exit()
    
    for i in node_lst:
        # strip off everything from first "#" found
        i = i.split('#',1)[0]
        if E.match(i):
            continue
    
        h = S.split(i,1)[0]             ## host name
        m = S.split(i,1)[-1]            ## MAC address
        mmap[h] = m.strip('\t|" "')
    
    for j, k in mmap.iteritems():
        if sys.argv[1] == j:
            if not re.search(X, k):
                print "Invalid MAC address [",k,"]; nothing to do!!"
                sys_exit()
            else:
                WakeOnLan(k.translate(f1_arg,':.-'))
                print "WOL request has been sent to %s [%s]" % (j,k)
                break
    else:
        print "Host [%s] doesn't exist!!" % sys.argv[1]
        sys_exit()

×
×
  • Create New...