fabtools.cron

Cron tasks

This module provides tools to manage periodic tasks using cron.

fabtools.cron.add_task(name, timespec, user, command)[source]

Add a cron task.

The command will be run as user periodically.

You can use any valid crontab(5) timespec, including the @hourly, @daily, @weekly, @monthly and @yearly shortcuts.

Examples:

from fabtools.cron import add_task

# Run every month
add_task('cleanup', '@monthly', 'alice', '/home/alice/bin/cleanup.sh')

# Run every tuesday and friday at 5:30am
add_task('reindex', '30 5 * * 2,4', 'bob', '/home/bob/bin/reindex.sh')
fabtools.cron.add_daily(name, user, command)[source]

Shortcut to add a daily cron task.

Example:

import fabtools

# Run every day
fabtools.cron.add_daily('backup', 'root', '/usr/local/bin/backup.sh')

Project Versions

Table Of Contents

Previous topic

fabtools

Next topic

fabtools.deb

This Page