Commits (1)
......@@ -99,6 +99,15 @@ def cleanup():
return len(pid_list)
def cleanup_cruft():
""" remove directories leftover from improper shutdown """
tmp_dirs = os.listdir(SAGE_TMP_ROOT)
for dir_entry in tmp_dirs:
baddir = os.path.join(SAGE_TMP_ROOT, dir_entry)
if os.path.isdir(baddir):
logger.warning('Removing old directory %s from SAGE_TMP_ROOT', baddir)
rm_rf(baddir)
def kill_spawned_jobs(jobfile, parent_pid):
logger.info("Killing %s's spawned jobs", parent_pid)
killed_them_all = True
......@@ -193,6 +202,7 @@ if __name__ == '__main__':
setup_daemon()
fix_old_mistakes()
logger.info("Starting sage-cleaner with PID %s", os.getpid())
cleanup_cruft()
if len(sys.argv) > 1:
wait = int(sys.argv[1])
......