else: pp and print("invalid strategy") elif command == "start": # TODO: This is just an alias for daemonized DM Loop with check for campaign if its still active if not (campaign.id_exists(arguments.id)): pp and print("[!] No such campaign exists!") exit(1) cp = campaign.get_campaign(arguments.id) if (cp["started"]): print("[+] Campaign Already Started") exit(1) campaign.start_campaign(arguments.id) pp and print("[+] Starting campaign `{}`".format(cp["name"])) n = os.fork() if n == 0 and pp: print("[+] Daemonized with PID", os.getpid()) elif pp: print("[+] Success") if n == 0: # pymongo is fork-unsafe mongoClient = pymongo.MongoClient("mongodb://localhost:27017/") db = mongoClient[DB_NAME] campaignCollection = db[COLLECTION_NAME] campaign = Campaign(db, campaignCollection)