def teardown(): global crontab_backup if crontab_backup: write_crontab(crontab_backup) else: delete_crontab()
def uninstall(): """ Uninstall tasks from cron. """ current_crontab = read_crontab() new_crontab = find_existing_jobs(current_crontab) if new_crontab: write_crontab(new_crontab) else: delete_crontab()
def uninstall(): """ Uninstall tasks from cron. """ current_crontab = read_crontab() new_crontab = '' for line in current_crontab.split('\n')[:-1]: if '%(python)s %(manage)s runtask' % { 'python': KRONOS_PYTHON, 'manage': KRONOS_MANAGE, } not in line: new_crontab += '%s\n' % line if new_crontab: write_crontab(new_crontab) else: delete_crontab()
def uninstall(): """ Uninstall tasks from cron. """ current_crontab = read_crontab() new_crontab = '' for line in current_crontab.split('\n')[:-1]: if '%(python)s %(project_path)s/manage.py runtask' % { 'python': sys.executable, 'project_path': PROJECT_PATH, } not in line: new_crontab += '%s\n' % line if new_crontab: write_crontab(new_crontab) else: delete_crontab()
def uninstall(): """ Uninstall tasks from cron. """ current_crontab = read_crontab() new_crontab = '' for line in six.u(current_crontab).split('\n')[:-1]: exp = '%(python)s %(manage)s runtask' % { 'python': KRONOS_PYTHON, 'manage': KRONOS_MANAGE, } if '$KRONOS_BREAD_CRUMB' not in line and exp not in line: new_crontab += '%s\n' % line if new_crontab: write_crontab(new_crontab) else: delete_crontab()