To complete the need of running jobs/tasks on a particular schedule, using PCF tasks scheduler, this recipe outlines the steps to successfully provision a job.
Scheduler for PCF
is installed on the platformScheduler for PCF
is installed. If not already, install scheduler-for-pcf-cliplugin-windows64-exe
from https://network.pivotal.io/products/p-scheduler-for-pcf
cf install-plugin C\path\to\scheduler-for-pcf-cliplugin-windows64-exe
To prevent the application from starting up immediately, set the instance count to zero in the manifest file. In addition, the buildpacks should be set to binary_buildpack
. Lastly, ensure the command attribute is set. Take notice of the stack when setting the command. In the example below, the windows stack defaults to the classic batch command.
For example:
applications:
- name: ((appname))
buildpacks:
- binary_buildpack
instances: 0
health-check-type: process
stack: windows
command: cmd /c .\MyApp.exe
path: bin/release
Execute cf push
For example:
cf push -f .\manifest.yml --var appname=my-app
Example, create a job called my-job
from a cf app called my-app
cf create-job my-app my-job "MyApp"
Example, schedule my-job
to run every 5 minutes
`cf schedule-job my-job "*/5 * ? * * "`