I was trying to add CRON jobs and found no guide. So here are the steps I followed
mkdir cron && cd cron
Creates directory and change into it.git init
New git initialization.touch captain-definition
Creates new captain config file.- In captain-definition add folowing code. It'll loads jobber image which works fine even if deprecated. We just need it to run a task in a schedule.
{
"schemaVersion": 2,
"dockerfileLines": [
"FROM jobber"
]
}
or you can try
{
"schemaVersion": 2,
"templateId": "jobber"
}
git add . && git commit -m 'New cron job for xxx'
It'll add to git.caprover deploy
Run it to deploy as for other apps.
Everything deployed!
Now add tasks
- SSH into your server
docker container ls
See all running containers and copy ID of thecron
(or what you named) container.docker exec -it <ID_HERE> sh
You'll move into container.cd /home/jobberuser/ && vi .jobber
Write your task following guide here and save it.exit
exits container and then rundocker restart <ID_HERE>
to restart container.
We're all done.