diff --git a/system/cron b/system/cron index 3bf43b7d562..23f8efe09b2 100644 --- a/system/cron +++ b/system/cron @@ -266,9 +266,10 @@ class CronTab(object): def remove_job_file(self): try: os.unlink(self.cron_file) + return True except OSError, e: # cron file does not exist - return + return False except: raise CronTabError("Unexpected error:", sys.exc_info()[0]) @@ -464,8 +465,7 @@ def main(): crontab.write(backup_file) if crontab.cron_file and not do_install: - crontab.remove_job_file() - changed = True + changed = crontab.remove_job_file() module.exit_json(changed=changed,cron_file=cron_file,state=state) job = crontab.get_cron_job(minute, hour, day, month, weekday, job, special_time)