def main():
    """
    The main function that will be executed when running this as a stand alone script.
    """
    my_name = os.path.basename(sys.argv[0])
    if not my_name:
        my_name = "yhsm-validation-server"
    syslog.openlog(my_name, syslog.LOG_PID, syslog.LOG_LOCAL0)

    global args
    args = parse_args()
    args_fixup()

    global hsm
    try:
        hsm = pyhsm.YHSM(device = args.device, debug = args.debug)
    except serial.SerialException, e:
        my_log_message(args, syslog.LOG_ERR, 'Failed opening YubiHSM device "%s" : %s' %(args.device, e))
        return 1

    write_pid_file(args.pid_file)

    try:
        run()
    except KeyboardInterrupt:
        print ""
        print "Shutting down"
        print ""
def main ( ) : my_name = os . path . basename ( sys . argv [ 0 ] ) if not my_name : my_name = "yhsm-validation-server" syslog . openlog ( my_name , syslog . LOG_PID , syslog . LOG_LOCAL0 ) global args args = parse_args ( ) args_fixup ( ) global hsm try : hsm = pyhsm . YHSM ( device = args . device , debug = args . debug ) except serial . SerialException , e : my_log_message ( args , syslog . LOG_ERR , 'Failed opening YubiHSM device "%s" : %s' % ( args . device , e ) ) return 1 write_pid_file ( args . pid_file ) try : run ( ) except KeyboardInterrupt : print "" print "Shutting down" print ""
The main function that will be executed when running this as a stand alone script.