plabrenewd.in 825 Bytes
Newer Older
Kirk Webb's avatar
Kirk Webb committed
1
#!/usr/local/bin/python
Kirk Webb's avatar
Kirk Webb committed
2 3 4 5 6 7
# -*- python -*-
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
Kirk Webb's avatar
Kirk Webb committed
8 9 10

import sys
sys.path.append("@prefix@/lib")
Kirk Webb's avatar
Kirk Webb committed
11
from libtestbed import *
Kirk Webb's avatar
Kirk Webb committed
12
import libplab
Kirk Webb's avatar
Kirk Webb committed
13
import getopt
Kirk Webb's avatar
Kirk Webb committed
14

15
RENEW_PERIOD = 6*60*60  # every six hours
Kirk Webb's avatar
Kirk Webb committed
16 17 18 19 20 21 22 23

def usage(me):
    print "Usage: %s [ -vd ]" % me
    sys.exit(1)
    return # NOTREACHED

def main(args):
    me = args[0]
Kirk Webb's avatar
Kirk Webb committed
24

Kirk Webb's avatar
Kirk Webb committed
25 26 27

    parser = TBParser()
    opts, args = parser.parse_args(args[1:])
David Johnson's avatar
David Johnson committed
28 29 30

    libplab.debug = opts.debug
    libplab.verbose = opts.verbose
Kirk Webb's avatar
Kirk Webb committed
31
    
Kirk Webb's avatar
Kirk Webb committed
32
    plab = libplab.Plab()
Kirk Webb's avatar
Kirk Webb committed
33
    daemon = pydaemon(pydaemon.SYSLOG)
Kirk Webb's avatar
Kirk Webb committed
34

Kirk Webb's avatar
Kirk Webb committed
35
    if not parser.values.debug:
Kirk Webb's avatar
Kirk Webb committed
36 37 38 39 40 41 42 43 44 45
        daemon.daemonize()
        pass
    
    daemon.daemonLoop(plab.renew, RENEW_PERIOD)

    return # NOTREACHED

if __name__ == "__main__":
    main(sys.argv)