示例#1
0
def main(params=None):
    parser = argparse.ArgumentParser(description='flux network deamon')
    add_daemon_arguments("fluxnetworkd", parser)
    options = parser.parse_args(params)
    apply_daemon_arguments(options)

    if options.stop_daemon:
        try:
            pid_handler = open(options.pidfile, 'r', 0)
            pid = int(pid_handler.read(), 10)

            proc = psutil.Process(pid)
            proc.terminate()

            proc.wait(5.)
            sys.exit(0)
        except psutil.TimeoutExpired as e:
            print("Error: Timeout while stopping daemon")
        except Exception as e:
            print("Error: %s" % e)
            sys.exit(1)
    else:
        return_code = deamon_entry(
            options, service="fluxmonitor.services.network.NetworkService")
        sys.exit(return_code)
示例#2
0
def main(params=None):
    parser = argparse.ArgumentParser(description='flux cloud deamon')
    parser.add_argument('-c', '--cloud', dest='cloud', type=str,
                        default='https://neuron.fluxmach.com',
                        help='Set cloud endpoint')

    add_daemon_arguments("fluxcloudd", parser)

    options = parser.parse_args(params)
    apply_daemon_arguments(options)

    if options.stop_daemon:
        try:
            pid_handler = open(options.pidfile, 'r', 0)
            pid = int(pid_handler.read(), 10)

            proc = psutil.Process(pid)
            proc.terminate()

            proc.wait(5.)
            sys.exit(0)
        except psutil.TimeoutExpired as e:
            print("Error: Timeout while stopping daemon")
        except Exception as e:
            print("Error: %s" % e)
            sys.exit(1)
    else:
        return_code = deamon_entry(
            options,
            service="fluxmonitor.services.cloud.CloudService")
        sys.exit(return_code)
示例#3
0
def main(params=None):
    parser = argparse.ArgumentParser(description='flux robot')
    add_daemon_arguments("fluxrobot", parser)
    parser.add_argument('--autoplay', dest='autoplay', action='store_const',
                        const=True, default=False, help='Auto play')
    parser.add_argument('--task', dest='taskfile', type=str, default=None,
                        help='A g-code file, if this arg given, robot will'
                             ' enter PlayTask and run g-code automatically')

    options = parser.parse_args(params)
    apply_daemon_arguments(options)

    if options.stop_daemon:
        try:
            pid_handler = open(options.pidfile, 'r', 0)
            pid = int(pid_handler.read(), 10)

            proc = psutil.Process(pid)
            proc.terminate()

            proc.wait(5.)
            sys.exit(0)
        except psutil.TimeoutExpired as e:
            print("Error: Timeout while stopping daemon")
        except Exception as e:
            print("Error: %s" % e)
            sys.exit(1)
    else:
        return_code = deamon_entry(
            options, service="fluxmonitor.services.robot.Robot")
        sys.exit(return_code)
示例#4
0
def main(params=None):
    parser = argparse.ArgumentParser(description='flux hal deamon')
    add_daemon_arguments("fluxhald", parser)
    parser.add_argument('--manually',
                        dest='manually',
                        action='store_const',
                        const=True,
                        default=False,
                        help='Connect to smoothie')
    parser.add_argument("--mb",
                        dest='mb',
                        type=str,
                        default=None,
                        help='Mainboard Serial Port')
    parser.add_argument("--hb",
                        dest='hb',
                        type=str,
                        default=None,
                        help='Headboard Serial Port')

    options = parser.parse_args(params)
    apply_daemon_arguments(options)

    if options.stop_daemon:
        try:
            pid_handler = open(options.pidfile, 'r', 0)
            pid = int(pid_handler.read(), 10)

            proc = psutil.Process(pid)
            proc.terminate()

            proc.wait(5.)
            sys.exit(0)
        except psutil.TimeoutExpired as e:
            print("Error: Timeout while stopping daemon")
        except Exception as e:
            print("Error: %s" % e)
            sys.exit(1)
    else:
        return_code = deamon_entry(
            options, service="fluxmonitor.services.hal.HalService")
        sys.exit(return_code)
示例#5
0
def main(params=None):
    parser = argparse.ArgumentParser(description='flux player')
    add_daemon_arguments("fluxplayer", parser)
    parser.add_argument('-c',
                        '--control',
                        dest='control_endpoint',
                        type=str,
                        default="/tmp/.player",
                        help='Listen control socket at')
    parser.add_argument('--task',
                        dest='taskfile',
                        type=str,
                        required=True,
                        help='F-Code to play')

    options = parser.parse_args(params)
    apply_daemon_arguments(options)

    if options.stop_daemon:
        try:
            pid_handler = open(options.pidfile, 'r', 0)
            pid = int(pid_handler.read(), 10)

            proc = psutil.Process(pid)
            proc.terminate()

            proc.wait(5.)
            sys.exit(0)
        except psutil.TimeoutExpired as e:
            print("Error: Timeout while stopping daemon")
        except Exception as e:
            print("Error: %s" % e)
            sys.exit(1)
    else:
        return_code = deamon_entry(options,
                                   service="fluxmonitor.player.main.Player")
        sys.exit(return_code)