I am fairly new to puppet and thinking if there is a way to apply a resource only after the command initiated by Exec completes it's job. My requirement is that I should schedule a backup job only after another job is completed. My code, given below doesn't work. The cron gets scheduled as soon as the primary-backup-job is initiated.
Edit: I need to run primary job only once in life-time of the container(using docker). Primary backup job can take upto 5 hours and secondary around one hour. Primary-backup-script.py uses subprocess.popen module, to start the job , which forks the job in background, but I don't think that is important. Correct me if I am wrong.
exec{ 'primary-backup-job':
command => '/path/primary-backup-script.py',
require => File['/path/primary-backup-script.py'],
refreshonly => true,
}
# Schedule cron job only after primary backup is completed.
cron{ schedule-secondary-backup:
command => "/path/secondary-backup-script.py",
require => Exec['primary-backup-job'],
user => root,
hour => 05,
minute => 00,
weekday => 1-5;
}
Any thoughts or suggestions?