salt.modules.schedule

Module for managing the Salt schedule on a minion

Requires that python-dateutil is installed on the minion.

New in version 2014.7.0.

salt.modules.schedule.add(name, **kwargs)

Add a job to the schedule

CLI Example:

salt '*' schedule.add job1 function='test.ping' seconds=3600
# If function have some arguments, use job_args
salt '*' schedule.add job2 function='cmd.run' job_args="['date >> /tmp/date.log']" seconds=60

# Add job to Salt minion when the Salt minion is not running
salt '*' schedule.add job1 function='test.ping' seconds=3600 offline=True
salt.modules.schedule.build_schedule_item(name, **kwargs)

Build a schedule job

CLI Example:

salt '*' schedule.build_schedule_item job1 function='test.ping' seconds=3600
salt.modules.schedule.copy(name, target, **kwargs)

Copy scheduled job to another minion or minions.

CLI Example:

salt '*' schedule.copy jobname target
salt.modules.schedule.delete(name, **kwargs)

Delete a job from the minion's schedule

CLI Example:

salt '*' schedule.delete job1

# Delete job on Salt minion when the Salt minion is not running
salt '*' schedule.delete job1
salt.modules.schedule.disable(**kwargs)

Disable all scheduled jobs on the minion

CLI Example:

salt '*' schedule.disable
salt.modules.schedule.disable_job(name, **kwargs)

Disable a job in the minion's schedule

CLI Example:

salt '*' schedule.disable_job job1
salt.modules.schedule.enable(**kwargs)

Enable all scheduled jobs on the minion

CLI Example:

salt '*' schedule.enable
salt.modules.schedule.enable_job(name, **kwargs)

Enable a job in the minion's schedule

CLI Example:

salt '*' schedule.enable_job job1
salt.modules.schedule.is_enabled(name=None)

List a Job only if its enabled

If job is not specified, indicate if the scheduler is enabled or disabled.

New in version 2015.5.3.

CLI Example:

salt '*' schedule.is_enabled name=job_name
salt '*' schedule.is_enabled
salt.modules.schedule.job_status(name, time_fmt='%Y-%m-%dT%H:%M:%S')

Show the information for a particular job.

CLI Example:

salt '*' schedule.job_status job_name
salt.modules.schedule.list_(show_all=False, show_disabled=True, where=None, return_yaml=True, offline=False)

List the jobs currently scheduled on the minion

CLI Example:

salt '*' schedule.list

# Show all jobs including hidden internal jobs
salt '*' schedule.list show_all=True

# Hide disabled jobs from list of jobs
salt '*' schedule.list show_disabled=False
salt.modules.schedule.modify(name, **kwargs)

Modify an existing job in the schedule

CLI Example:

salt '*' schedule.modify job1 function='test.ping' seconds=3600

# Modify job on Salt minion when the Salt minion is not running
salt '*' schedule.modify job1 function='test.ping' seconds=3600 offline=True
salt.modules.schedule.move(name, target, **kwargs)

Move scheduled job to another minion or minions.

CLI Example:

salt '*' schedule.move jobname target
salt.modules.schedule.postpone_job(name, current_time, new_time, **kwargs)

Postpone a job in the minion's schedule

Current time and new time should be in date string format, default value is %Y-%m-%dT%H:%M:%S.

New in version 2018.3.0.

CLI Example:

salt '*' schedule.postpone_job job current_time new_time

salt '*' schedule.postpone_job job current_time new_time time_fmt='%Y-%m-%dT%H:%M:%S'
salt.modules.schedule.purge(**kwargs)

Purge all the jobs currently scheduled on the minion

CLI Example:

salt '*' schedule.purge

# Purge jobs on Salt minion
salt '*' schedule.purge
salt.modules.schedule.reload_()

Reload saved scheduled jobs on the minion

CLI Example:

salt '*' schedule.reload
salt.modules.schedule.run_job(name, force=False)

Run a scheduled job on the minion immediately

CLI Example:

salt '*' schedule.run_job job1

salt '*' schedule.run_job job1 force=True
Force the job to run even if it is disabled.
salt.modules.schedule.save(**kwargs)

Save all scheduled jobs on the minion

CLI Example:

salt '*' schedule.save
salt.modules.schedule.show_next_fire_time(name, **kwargs)

Show the next fire time for scheduled job

New in version 2018.3.0.

CLI Example:

salt '*' schedule.show_next_fire_time job_name
salt.modules.schedule.skip_job(name, current_time, **kwargs)

Skip a job in the minion's schedule at specified time.

Time to skip should be specified as date string format, default value is %Y-%m-%dT%H:%M:%S.

New in version 2018.3.0.

CLI Example:

salt '*' schedule.skip_job job time