From fcba21b96b10e7cd5495b9644e716dbed745840a Mon Sep 17 00:00:00 2001
From: David Robert Verelst <dave@dtu.dk>
Date: Sun, 28 Aug 2016 09:05:13 +0200
Subject: [PATCH] launch.py: add cronjob to crontab after first round of
 submitting

---
 launch.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/launch.py b/launch.py
index 87270f1..d9c0648 100755
--- a/launch.py
+++ b/launch.py
@@ -970,8 +970,6 @@ if __name__ == '__main__':
                    debug=options.debug, cpu_user_queue=options.cpu_user_queue)
     ss.tsleep_short = options.tsleep_short
     if options.crontab:
-        if not os.path.exists(os.path.join(os.getcwd(), 'launch_crontab.sh')):
-            write_crontab(every_min=options.every_min)
         if os.path.exists(ss.fname_config):
             ss.read_config()
         else:
@@ -981,3 +979,7 @@ if __name__ == '__main__':
         ss.write_config()
         ss.init_state_log()
     ss(depend=options.depend, crontab_mode=options.crontab)
+    # start crontab job after first round of launching to prevent it from
+    # running more than once
+    if options.crontab:
+        write_crontab(every_min=options.every_min)
-- 
GitLab