Selaa lähdekoodia

event are loaded at each start

nico 8 vuotta sitten
vanhempi
commit
010c060bf3
2 muutettua tiedostoa jossa 8 lisäystä ja 8 poistoa
  1. 2 2
      Docs/signals.md
  2. 6 6
      jarvis.py

+ 2 - 2
Docs/signals.md

@@ -86,9 +86,9 @@ The synapse in the brain would be
       - event: "0 7 * * 1,2,3,4,5"
       - event: "0 7 * * 1,2,3,4,5"
 ```
 ```
 
 
-After setting up an event, we must call a jarvis command to load the crontab automatically
+After setting up an event, you must restart jarvis
 ```
 ```
-python jarvis.py load-events
+python jarvis.py start
 ```
 ```
 
 
 If the syntax is ok, JARVIS will show you each synapse that he has loaded in the crontab
 If the syntax is ok, JARVIS will show you each synapse that he has loaded in the crontab

+ 6 - 6
jarvis.py

@@ -30,7 +30,7 @@ def main():
     """
     """
     # create arguments
     # create arguments
     parser = argparse.ArgumentParser(description='JARVIS')
     parser = argparse.ArgumentParser(description='JARVIS')
-    parser.add_argument("action", help="[start|gui|load-events]")
+    parser.add_argument("action", help="[start|gui]")
     parser.add_argument("--run-synapse", help="Name of a synapse to load surrounded by quote")
     parser.add_argument("--run-synapse", help="Name of a synapse to load surrounded by quote")
     parser.add_argument("--brain-file", help="Full path of a brain file")
     parser.add_argument("--brain-file", help="Full path of a brain file")
     parser.add_argument("--debug", action='store_true', help="Show debug output")
     parser.add_argument("--debug", action='store_true', help="Show debug output")
@@ -65,6 +65,11 @@ def main():
             SynapseLauncher.start_synapse(args.run_synapse, brain_file=brain_file)
             SynapseLauncher.start_synapse(args.run_synapse, brain_file=brain_file)
 
 
         if args.run_synapse is None:
         if args.run_synapse is None:
+            # first, load events in crontab
+            crontab_manager = CrontabManager(brain_file=brain_file)
+            crontab_manager.load_events_in_crontab()
+            Utils.print_success("Events loaded in crontab")
+            # then stat jarvis
             Utils.print_success("Starting JARVIS")
             Utils.print_success("Starting JARVIS")
             Utils.print_info("Press Ctrl+C for stopping")
             Utils.print_info("Press Ctrl+C for stopping")
             # catch signal for killing on Ctrl+C pressed
             # catch signal for killing on Ctrl+C pressed
@@ -75,11 +80,6 @@ def main():
     if args.action == "gui":
     if args.action == "gui":
         ShellGui()
         ShellGui()
 
 
-    if args.action == "load-events":
-        crontab_manager = CrontabManager(brain_file=brain_file)
-        crontab_manager.load_events_in_crontab()
-        Utils.print_success("Events loaded in crontab")
-
 
 
 def configure_logging(debug=None):
 def configure_logging(debug=None):
     """
     """