From 19c00ad8a6365a61573e91e1ced9523dfdf8c0d2 Mon Sep 17 00:00:00 2001
From: David Robert Verelst <dave@dtu.dk>
Date: Mon, 29 Aug 2016 08:57:10 +0200
Subject: [PATCH] launch.py: fix bug from previous commit, write cronjob when
 in crontab mode

---
 launch.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/launch.py b/launch.py
index 94a915d..2c395f1 100755
--- a/launch.py
+++ b/launch.py
@@ -643,7 +643,7 @@ class Scheduler:
             print self.path_pbs_files
             print "I have no choice but to abort the launch sequence."
             print ""
-            return
+            return 'nothing'
 
         time0 = 0.0
         while True:
@@ -705,7 +705,7 @@ class Scheduler:
                 ii += 1
             elif crontab_mode:
                 save_pbsflist(self.f_pbsflist, pbsflist[ii:])
-                return
+                return 'crontab'
             else:
                 # wait a bit before trying to launch a job again
                 if self.debug:
@@ -723,7 +723,7 @@ class Scheduler:
                 print 'All jobs have been launched, stopping the scheduler.'
                 if crontab_mode:
                     remove_crontab()
-                return
+                return 'done'
 
     def launch_deps(self):
         """Launch
@@ -994,8 +994,8 @@ if __name__ == '__main__':
     else:
         ss.write_config()
         ss.init_state_log()
-    ss(depend=options.depend, crontab_mode=options.crontab)
+    status = 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:
+    if options.crontab and status == 'crontab':
         write_crontab(every_min=options.every_min)
-- 
GitLab