~yerinalexey/pcrond

ref: 09f14076d6d23f741d026289ed6933f4e97fe4b0 pcrond/scripts/pcrond -rwxr-xr-x 852 bytes
09f14076 — Alexey Yerin chore: rewrite README in markdown 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python

VERSION = "1.0"

def parse_args():
    import argparse
    import path
    import os

    default_crontab = path.join(os.environ["HOME"], ".config/pcrond/crontab")

    parser = argparse.ArgumentParser(description='Launch a crond-like daemon in userspace.')
    parser.add_argument('-c', '--crontab',
                        help='the crontab file (default ~/.config/pcrond/crontab)',
                        default=default_crontab)
    parser.add_argument('-v', '--version', action='store_true', help='print version then exit')
    args = parser.parse_args()

    return args

if __name__ == "__main__":
    args = parse_args()
    if args.version:
        print(VERSION)
        exit(0)

    from pcrond import Scheduler

    scheduler = Scheduler()
    scheduler.load_crontab_file(args.crontabfile)
    scheduler.main_loop()