Rush Logo Rush Render Queue - The rush/etc/bootcheck file
V 103.07b 05/11/16
(C) Copyright 2008, 2016 Seriss Corporation. All rights reserved.
(C) Copyright 1995,2000 Greg Ercolano. All rights reserved.


   Bootcheck Script  
    The bootcheck script is an administrative script the systems administrator can configure to run checks just before the Rushd daemon/service starts.

    This allows a single script to intercept the daemon startup across platforms consistently, instead of having to hack boot scripts.

    Common things to test are if mounts are in place, drive maps have been mapped, if DHCP has resolved the machine's IP address, DNS/hostname lookups are working, temp directories cleared, etc.

    This script is enabled by uncommenting these lines (shown in red) in the rush.conf file:

        Bootcheck Configuration in rush.conf
        
        # BOOT CHECK COMMAND
        #	Command run during boot to check if machine is ready.
        #	Uncomment + modify example scripts as needed.
        #
        os=windows bootcheck_cmd "perl c:/rush/etc/bootcheck"
        os=unix    bootcheck_cmd "perl /usr/local/rush/etc/bootcheck"
        	

      NOTE #1: You can rewrite this script in python, or any other language you prefer, as long as the language is installed on your machines. Just change 'perl' in the above commands to 'python', 'sh', or whatever you prefer, and rewrite the script in that scripting language.

      NOTE #2: In Rush 103.07b, the bootcheck_cmd is enabled by default to run the 'rush -bootcheck' command. This is to solve issues with some OS's starting rush before networking is ready. You can still change this to run your own script instead, or the default bootcheck script.

    If you are only concerned with running bootcheck on a single machine, you can enable this script to be executed only on that particular machine using a host= prefix to target a single machine (or +hostgroup of machines), e.g.

    
          host=tahoe      bootcheck_cmd "perl /usr/local/rush/etc/bootcheck"
        

    When enabled, this script will be run right when the Rushd service starts, but before it initializes itself to load any config files and start renders.

    The script should simply loop if the machine is not ready; when the script returns, Rushd will finish initializing.

    Currently exit codes are ignored, but the exit code of your script should be zero. Basically your script should not return until the machine is fit for rendering.

    Note that the script will not be able to run 'rush' commands, as the service's network ports are not yet listening for connections. So you can only interact with the operating system from this script.

    You should modify the logic of this script to do whatever checks you want. To check that networking is up, you can check commands like 'ifconfig', 'ipconfig /all', 'netstat -r', etc. To check hostname resolution, you can use commands like 'ping', 'nslookup', etc.

    For reasons that should be obvious, this script must exist LOCALLY on each machine in order to be available when file servers might be down or unavailable. Since the script lives in rush/etc, it can be pushed around the network with 'rush -push bootcheck +any'.

Caveats

  • It's important this script live LOCALLY ON EACH MACHINE, so it can be executed even if the file server is inaccessible.. a problem you might want to detect in the script, defeating the purpose if the server is down..!
  • Any output from the script will be appended to the rushd.log file unless redirected elsewhere. Include date stamps in your messages so that one can determine when the messages were generated by reviewing the log file. NOTE: In versions older than 103.07b, there was a bug that didn't handle redirection correctly, and the script had to redirect its own output. This bug was fixed in 103.07b.
  • To avoid excessive log output, it's recommended the script not print anything on success, and only show messages when errors occur. This prevents needless trafficking of the logs.
  • If your script does print anything, it should probably include the current date+time, so that the log shows when problems happened.
  • By having the script exist as $RUSH_DIR/etc/bootcheck, the script can be easily distributed among all the machines using 'rush -push, e.g.:

        rush -push bootcheck +any           # push the bootcheck script to all machines
        

  • Note this script runs as root on Unix, and runs as the user the Rushd service is configured to run as on Windows. Keep this in mind when customizing your script.
  • Do not use 'rush' commands to interact with the local rushd daemon/service, as when this script is running, the service has not yet initialized. (The whole point of this script is to determine if the service should be initialized, so by definition the script has to run before the service is started.)
  • This script will run on all machines when they reboot, so keep in mind your script might be running in a hostile environment. For example just after a power outage when all the machines are rebooting (file servers, DNS servers, DHCP/LDAP + Mail servers, etc). So consider that configuring sending emails on failure may result in a mass mailing if the entire network reboots, and may even bounce all messages if the mail server is not up yet. Please code wisely.
  • This script can be written in any language; it does not have to be perl. You can use Python, Bash, or whatever scripting language your OS supports. Also, if written with cross-platform execution in mind, a single script can be used to manage all of your platforms.
  • Code this script carefully: it's easy to try 'too hard' to fix a problem.

See Also